I used to use a Fiio X1 player. This one had a playback mode that would make the player stop the playback once it finished the selected track. After idling for a while it would shut down, which was a separate feature. Implementing this should be fairly simple but quite useful if you're listening to a podcast or something.