Fix crash on quit.