Clean up gitignore
Fix resource leak when response status code is invalid