Close old sockets preventing file handle leaks