FredFred,
Just put your file write in a case structure so it only happens on error.
See attached modification. You might also want to cleanup some weird boolean logic, e.g. a "Not equal false" is the same as the original wire and can be skipped. A "Not equal true" is the same as a logical invert. You can also combine many ORs into a compound node.
You also don't need the "select" node for the sequence string in cases 1 and 2. The corret string is given by the case selection already.
How quickly do the cases execute? If they are pretty fast, it might be easier to place the boolean indicators outside the main case structure (but inside the main loop) and use wires, eliminating all local variables.