Only fclose($fp) when $mode & NET_SFTP_LOCAL_FILE.

Fixes #418