Set close-on-exec flag to the socket descriptor