upadte main.c missing closing of sockets