prevent fatal errors on sends while the socket is closing