Make sure we're not closing before sending a message to incomingMessages.

Fixes #1.