paramiko/paramiko — pull request #323 by rdkls (2014-05-07 08:09:56+00:00)
Title: sftp putfo(): don't close destination file pointer until we have stat'd ...

...it - avoids situation where something on the remote end (e.g. inotify) removes files immediately after they're written

I was delivering media to a remote service which must have had inotify watching for the empty file to signify 'transfer complete' (e.g. inotify close_write).
The listener would immediately remove the file, and start ingesting the media - causing paramiko to not be able to stat() the file.
This change just means we don't close() the remote file until we've stat'd it first, thus avoiding this problem.