The issues discussed here arise after the stage of diary generation where QuarkXPress is saving the generated output file, while it is shutting down. This usually happens only with QuarkXPress 6, and above, for very short diaries (fewer than 10 pages), and on very fast computers (2GHz and more).
If QuarkXPress is crashing upon closing, but after a successfull diary generation (ie. you can see the output file in the c:\temp\qpp\tmpopf\ folder and it is fine), then you should try to set the XNT Temp Files property to Do not try to delete.
If the above does not work, set the Add Buffer End Pages property of the current script to true.