Added nil check on response.Body before closing