playlist: fix infinite loop while clearing the playlist