close socket on exit