[macos] Prevent race condition while creating the EGL Window