@webodan I found my own solution in this github post. All it took was adapting his SwitchToKodi script to kill Xorg after emulationstation was dead instead of having a user switch.