Only my note to that:
Oracle recommend to not disposing the player if you want to continue playing files... (
https://docs.oracle.com/javafx/2/api/javafx/scene/media/MediaPlayer.html#dispose()).
I have found out, that you can delete the files later, when you play other files in the meantime. So I simply try to delete the file and if that fails, I save it in a list. Then I try in a timer (eg. any 30s) to delete it again - this worked for me most of the time after one or two minute or so. Lastly, I save the list, and if necessary delete the files at the next program start...
Btw: I have also make some tries with disposing - then I was
sometime able to delete the files instantly, but not always... So there was no big difference to my final solution - and I decided to follow the recommendation of Oracle.