How should SSE handlers avoid losing terminal error events when stream state changes mid-failure?