Fix for "no free sockets" problem

My testing shows that the DNS query wasn't closing sockets, and they were remaining open indefinitely.  I've added a close(s) to fix this.