The problem is probably that the script isn't stopping the shutdown process.
Until now I don't have a clue how to fix it. It was working with Ubuntu Mate 22.04 -__-
https://forums.linuxmint.com/viewtopic.php?p=2508747
https://unix.stackexchange.com/questions/781743/how-to-update-firefox-on-shutdown