Send an event on ClientClosed, and factor out some cut-and-paste