Fix not closing the http request if there was an error.

Add some comments to the file.