Fixes #939, @lefticus can you code review this?

[#68761808]
Fixing issues identified by @lefticus in code review

[#68761808]
Attempting to stop race condition by not getting output files twice

[#68761808]