Fix the logic in recursiveModuleCompileToSingleFile to always revert the cwd no matter what

As mentioned in the discussion for the last pull request, I had a small error in logic for reverting the current working directory in the case that writeTreeToFile caused an exception to be thrown. This should now be fixed.