Close socket before continue