fix for issue #551 "Print window is crashing in the middle of all prints...

this works on linux, not tested on other platforms but should work (standard code)