extend and cleanup use of closesocket()

- add missing closesocket() calls for BindListenPort()
- call closesocket() before printing any text (ensure consistent
  usage in the code), exception is when using NetworkErrorString()
add CSocket (RAII class that provides access to a SOCKET)