I have a old script that I have renewed changing some app.response() with a custom popup dialog (or GUI). It recopiles 3 data types and works with it, creating new docs and reordering original PDF's pages in some ways. But in the GUI version, the app.newDoc() instruccions return this error. In some functions I use file_name.extractPages() and it works perfectly.
I close the GUI with dialog.end() before to call any function in the ok: function(dialog) division.