clean up procedure before quit game?

I think you can try to use Panda’s window-event as described in this topic [Close window)