Handle disconnecting in safe_send