Some lower to mid level trainers have estranged floors or ceilings that lead to needing to shift, to hit the top ends of power, even in ERG mode. Those are noted cases that require shifting to harder gears further in the test.
But your case sounds like a bail out and is not ideal. If you are shifting to make it easier, that is counter to the process of the test. It is all about increasing stress and fatigue to a point of failure.
Shifting to an easier gear in ERG is a bit of a cheat for a moment, you get some relief as the resistance unit works to get you back to the target wattage. You lose the power, so it penalizes you in a sense if you pop within a minute of the shift. But if it takes you further into the test than you could do without the shift, I see that as a mistake, IMHO.
Ride the rest straight and pop when you pop.