When cancelling a download, ensure file is closed before unlinking

Otherwise, Windows will fail with:

  Unix.Unix_error(Unix.EACCES, "unlink", "...")

Also, just log a warning if we still can't delete the temporary file.