Added signal interrupt to close the socket