closesocket() replacement for close() on Windows