SFTP: optimize conditional calls to fclose in get() method