httpRespToErrorResponse() usually reads the http response when the http error code is not expected to parse the json error response in the http body, however it was never properly closing the connection. This PR fixes the behavior.