Freezing on an open stream when removing a headset

When removing a headset (wired or BT) while a recording stream is open, the stream freezes. Windows OS + SDL 3.4. Calling SDL_Quit or SDL_DestroyAudioStream on a frozen stream also causes the freeze. The playback stream does not experience this issue. Is there a solution or what should I look for?

This was just fixed in SDL3 a few days ago: