Fix leaking socket objects

In the case of multiple workers, a handshake might create a socket object in one worker
and the subsequent websocket session started on the other, leaving one socket object
in the NEW state forever.