We try to explain the the best way to do things here.
Well, if the sketch works for you as it is, then what you want should be simple.
When a/any LED(s) are flashing, set a Flag variable to true.
When a/any LED(s) stop flashing reset this Flag.
When it comes to the time or event when things should reset, and if the Fag is true, make your counter zero (0) and stop flashing.