close socket on exception