Fix race conditions in QC generation, handling partially completed results and simultaneous runs on the same file. Fixes #311