add handling os signals, shutdown code and proper closing of sockets