Close socket used for port allocation.