prevent SOCKET leack in BindListenPort()

- the call to CloseSocket() is placed after the WSAGetLastError(), because
  a CloseSocket() can trigger an error also, which we don't need for the
  logging in this two cases