> But if you later change the code and try to relock the working dir, you're stuck right?

Sorry, I'm not following. Change the code to relock where?

>  What's the problem with `scope (exit)`?

As the sole way to release the lock: it releases the lock in the wrong place, the lock must be released before the user's program is launched.
As an additional way to release the lock: it's redundant, as it will run at the end of main(), and the OS will release the lock anyway.

Anyway, I added a redundant `scope(exit) unlockWorkPath();` in the last revision, because now two people asked about it.