Synchronise with an RPC after sending a message

Closing the connection can have the effect of abandoning frames that
haven't been written yet. This is noticable with recent versions of
when.js (v2.5.1 say) which will run the thunk given to `.ensure`,
thereby closing the connection, before the publish has been written to
the socket.