proper exit of Kodi with UPS shutdown

Hi all,
I’m running Kodi 17.3 on a Mac mini running macOS Sierra 10.12.5. I have an APC UPS connected and configured to the shutdown the Mac mini when on battery after 5 min.
Now my question is: When the Mac OS is shutting down the computer, will it correctly exit Kodi in a proper way?

Before I had no UPS and I had a power drop while watching a movie on Kodi, after the power went back on, my database was corrupted, due to this uncontrolled power down.

Or do I need some kind of scripting with json-rpc (Application.Quit) before shutting down the computer, so Kodi exits correctly?

Hope anybody finds me an answer.

Txs,

Jeroen