close socket before reuse it