Fix infinite loop when we can't create the lock_dir directory.