You might try adding some exception handling to your application to make sure that if the app closes abnormally, at least the audio driver gets closed. I understand you can use TRY/CATCH expressions, but I don't have experience with them myself.
If your application ends up leaving the device driver open, I think the only way you can clear it is to to restart CE (e.g. \windows\restart.exe).