Fix a possible race condition when shutting down WinMM devices
Fix a possible race condition when shutting down WinMM devices

If the processing threads are interrupted between the shutdown check and re-
adding the buffer back to the device, the device can be left with a buffer that
will get unprepared and freed while in use.

alexxvk/openal-soft,BeamNG/openal-soft,franklixuefei/openal-soft,dapetcu21/openal-soft,mmozeiko/OpenAL-Soft,alexxvk/openal-soft,AerialX/openal-soft-android,arkana-fts/openal-soft,cambridgehackers/klaatu-openal-soft,Wemersive/openal-soft,jims/openal-soft,irungentoo/openal-soft-tox,Wemersive/openal-soft,aaronmjacobs/openal-soft,rryan/openal-soft,cambridgehackers/klaatu-openal-soft,EddieRingle/openal-soft,mmozeiko/OpenAL-Soft,franklixuefei/openal-soft,cambridgehackers/klaatu-openal-soft,aaronmjacobs/openal-soft,arkana-fts/openal-soft,EddieRingle/openal-soft,jims/openal-soft,BeamNG/openal-soft,rryan/openal-soft,irungentoo/openal-soft-tox