Fix issue with HTTPClient closing already closed connection