closing sockets after finishing work