Wait for the audio thread when calling stop.

- In some cases the audio hardware was still busy while a new thread was
started.
- Some smaller improvements.