Clear the runtime finalizer on socket close

This removes the need for the confusing closed bool in the socket
struct, makes the code easier to understand and fixes #1.
Handle EINTR in socket close on garbage collection