context: I have a button called exit which calls an app_exit function which just calls the quit function.
The python quit() and exit() functions are meant to be used in the REPL only. You need to use sys.exit() or raise SystemExit.
quit()
exit()
sys.exit()
raise SystemExit