prevent SOCKET leak in BindListenPort()

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