Fix race condition on creating the temp directory for ControlPersist

Fixes #3943