signal handlers are added to clean sockets on close

on sigterm and sigint sockets are cleaned.