Handle signal interrupt to close socket