close socket before redirecting