enforce close of socket before reconnect