What may have happened is the sequencer recorded the notes after the modulation in the new key, BUT........ it may have recorded the button push for transposition and is applying that to the already transposed notes. You don't say if you are using an external sequencer or internal. If external, take a look at the List Edit for the midi file and see if there are some unusual CC codes or some Sysex at the point where things go wrong.

I may be off here, but it's worth a look.

HTH
_________________________
An arranger is just a tool. What matters is what you build with it..!