Set O_CLOEXEC in MT-safe way

...