DynaPDFMBS Importpages error

Im trying to merge two PDF files… one that I am creating in memory, and one that is on disc.
Using DynaPDF from MBS

It errors on the notified line with a message that says ‘3: ImportPDFFile: OpenPage detected’

Does anyone know what that means and how to avoid it?

My code: (pdf is initialised before this code)

[code] pd = GetFolderItem(theapp.pdfsetts.pdfcoverDocument)
if pd <> nil then
if pd.Exists then

        if uppercase(right(pd.Name, 4)) = ".PDF" then
          //import as pdf
          dim flags as integer = Bitwise.BitOr(pdf.kifImportAsPage, pdf.kifImportAll)
          call pdf.SetImportFlags(flags)
          call pdf.openimportFile(pd, pdf.kptopen, "")
          call pdf.ImportPDFFile(pdf.GetPageCount+1, 1.0, 1.0)     <<this line errors
          call pdf.CloseImportFile


//another kind of document such as an image has been selected
end if

you should not import a PDF File while still having a page of for editing.

you can put a snippet there like this:

if d.HaveOpenPage then call d.EndPage end if

to close open page.

Thats what I needed.
Calling .endpage alone causes a blank first page (Im trying to start the new document with a cover page), but I have worked around that by also calling

Thanks Christian.