There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
remoteFile not closed if error on localFile
in both of your copy function : CopyFileFromDevice and CopyFileToDevice, there is no check if new FileStream works for localFile. So if it an exception is dispatch from it, remoteFile is not closed and we can't delete the remote file.
I had this error when I test CopyFileFromDevice without overwrite (the file exist on PC) and I wanted to delete remote file after that.