Bug fix to handle end of sounds properly during playback.