How to verify if an audio file has completed playing on the DFPlayer Mini

There is a busy pin on the DFPlayer Mini. When you launch a command you should wait for this pin to get active (the pin goes "LOW" when a song is playing if I remember well) as the command needs a bit of time to be decoded from the Serial line and then it will stay LOW while the sound is playing. When the audio is completed, it will read HIGH again and you'll know it's done.

you might benefit from studying state machines. Here is a small introduction to the topic: Yet another Finite State Machine introduction