Move CONNECTION_END termination after EndWrite.
Disconnect clients when they send a connection end message.