Fix crash on shutdown in Qt

Clicking "X" segfaulted it, now it quits okay.

-[Unknown]