Delete the temporary file if a download fails or is interrupted
Merge pull request #857 from mdboom/utils/delete-file-when-download-fails

Delete the temporary file if a download fails or is interrupted