Fix race between connectionClosed() and ConnectionHandler()

Yay, first pull req in a long time :)