When using the debug option in Session object WinSCP script will not consecutively run

When using the debug option in Session object WinSCP script will not consecutively run

I use a PowerShell script to automate a simple transfer from an FTP server to another local server. I started having issues with the transfer and wanted to turn on the debug mode in WinSCP as I do not see any issues in my PowerShell logging. However, when I run my script with a DebugLogPath set, the debug file creates and logs data (however, the log file size stays at 0 kb until I open the file, generally indicating there is a handle to it still), however, if I try and run the script again it fails. If I take the debug flag off, no problems.
[/quote]
Applicable code below. If I run this session, close out PowerShell, then open a new PowerShell console and run again, i get this failure (FYI Line 66 is the session object instantiation[/code] bellow: