Properly remove all undo stacks when quitting application with CTRL-Q
to avoid the crash