added line to close socket