shutdown socket before closing