make sure we disconnect cleanly from server