right after this:

    scope(exit) unlockWorkPath(workDir);