Fixed closing of sockets on Linux.