close socket on error

There are cases where a request can not be idempotent (when a
request_block is used #235) or using the idempotent middleware is not
desired. This ensures the socket is closed if the error is rescued and
the request is retried.

This also prevents an issue with the test suite, where a test can fail
and subsequent tests will fail because they receive the response body
from the previous test's request, or 'bad write retry' errors occur.