avdevice/alsa: wait until playback buffers are drained before closing