Fixed bug when calling close

Keep track if the socket has been closed or not, but keep the actual
socket around.
Make sure we get AGAIN on timeout