fixes close socket before interub thread