Move CloseSocket() (and NetworkErrorString() which it uses) from
netbase.{h,cpp} to newly added src/util/sock.{h,cpp}.
This is necessary in order to use CloseSocket() from a newly
introduced Sock class (which will live in src/util/sock.{h,cpp}).
sock.{h,cpp} cannot depend on netbase because netbase will depend
on it.
This is a backport of core#20788 [2/5]
https://github.com/bitcoin/bitcoin/pull/20788/commits/dec9b5e850c6aad989e814aea5b630b36f55d580
Depends on D11003