abort printing when force-closing a window
fix memory leak and bad assertion