Better handle exceptions and prevent leaking of pooled http connections