When HTTP fetch or flush failed, the code explicitly closed the file
and deleted it before returning an error. But returning an error also
triggered the errdefer block which tried to close the file again,
causing a crash on Windows where CloseHandle asserts success.
The fix removes the explicit close/delete calls in error paths since
the errdefer already handles cleanup. The errdefer pattern is the
correct way to handle this - it ensures cleanup happens exactly once
whether we return normally or with an error.
When an HTTP fetch fails, downloadToFile explicitly closes the file
before returning an error. The error return then triggers the errdefer
block which tries to close the file again, causing a crash.
This test uses an unreachable URL (localhost port 1) to trigger the
HTTP error path and reproduce the double-close bug.