Close socket used for port allocation.

I have seen some strange issues with such half-opened sockets, e.g. on Windows where you can't use SO_REUSEADDR.