Stop TLS sockets being closed when attaching

When calling attach_socket, the response is garbage collected,
which triggers a close method on the file object, closing the socket.
This stop the response from being garbage collected until we've
finished with the underlying socket.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>