i am not sure about what i am about to say : if you removed M5 from the code, so shorten whatever, than it may be a behaviour on the machine that is not constant

when it works, spindle is stopped, and M19 can occur ; otherwise you are in trouble

after testing CTR codes, i can tell that, even if more axis perform simulateously, they dont always behave the same : in other words syncro is always achieved, but start moments are not always the same

when machine reaches M19, is the spindle always stopped ? also, if the machine reaches M19 in the read ahead, and at that moment spindle is not stopped but meanwhile tool change occurs, than this may be your issue; maybe you need to delay the read ahead, to be sure that M19 is triggered when spindle is stopped

... i dont know just an opinion ... kindly !