Consider this scenario:
You have multiple audio output devices in your OS, and your run an SDL2 program that opens one of them with SDL_OpenAudioDevice().
If you disable the used device (f.ex. removing a USB headset or manually disable it) in your OS while the program is running, then call SDL_CloseAudioDevice() when the program is shut down, it will stall forever in said function. This is a pretty serious bug, because there’s nothing the user and developer can do to overcome it, since closing the audio device is a crucial step in an exit cleanup.
It seems that SDL_Quit() will also freeze, so I assume that something with the audio device cleanup is happening there as well.
This is tested and confirmed to freeze on Windows 10 and macOS 10.12.4 (latest). I have no idea if it freezes on other OSes and versions, but it’s likely.