remove extraneous file-selection dialog, write to temporary file then rename to pdf so file is not detected before it has been fully written