You are not logged in.
So, my HTPC starts an autologin Kodi session with LightDM upon boot.
When I need to restart the X server for some reason, Kodi crashes instead of exiting gracefully. I restart LightDM with systemctl.
Is there a way to restart the display manager and have the running graphical applications exit gracefully?
Offline
Send the appeopriate signal to Kodi before killing X. Write a wrapper script, that does both.
Find out why Kodi is unable to terminate in time and needs to be killed.
Start Kodi from a systemd user unit that slows down the process on exit.
Research LightDM problems and use SDDM instead.
Realize, that Kodi is a heavy software system, that runs its own SQL server instance and cannot be zapped like this without going over timeouts of something like an X zap or a DM service kill.
Offline
I have the exact same setup as you and Kodi can take normally 10 seconds to quit, sometimes up to 2 minutes. Fortunately I never need to restart X or lightdm but if I did I would find it easier to use Kodi to just restart the entire PC.
I have found that Kodi can hang occasionally and a killall -9 kodi.bin seems to fix this (to save having to button the PC).
But yeah to answer your question, do what Awebb says
send a TERM signal to kodi first to ask it to exit gracefully and then restart lightdm.
Offline