Fix potentially unsafe access in ServerMessageSocket::close()

If not called from the event loop, this function would access state
unsafely; moreover, if called twice, it would corrupt the OpaqueServer's
sockets vector.
Fix invalid memory access after socket disconnect

Fix #1: valgrind error in RPCClientServerTest.timeout test

The MessageSocket code attempted to read, then write the socket. If it
was disconnected, it was unsafe to do both, since the socket object
could get destroyed in between. Now it just handles one event and
returns to the event loop.

Thank you valgrind :)