SFTP: $content isn't defined when file is being written to