Use closesocket() instead of close()

Previously, socket_helpers.h would just define close() to whatever is
needed to close a socket. However, this makes it possible to
accidentally call a socket-specific close on something that is not a
socket. Having to explicitly call closesocket() (and defining it to
close() on platforms where it's the same) prevents this.