Set the CLOEXEC flag on the socket atomically if possible.