OCR with PDFPenPro script questions

I use OCR with Pdfpenpro AppleScript and it works well generally but
sometimes it is doing so fast that when I am prompted to give a title by the time I write title it has do OCR twice so I end up with 2 files .
sometimes for no reason apparent to me it goes in endless loop. What am I doing wrong?
the script I use is well known from Katie Floyd/ David Spark in around 2010:
tell application "PDFpenPro"
open theFile as alias
tell document 1
ocr
repeat while performing ocr
delay 1
end repeat
delay 1
close with saving
end tell
quit
end tell
Can I change delay to 2 or 3?
sometimes it is doing so fast that when I am prompted to give a title by the time I write title it has do OCR twice so I end up with 2 files .
sometimes for no reason apparent to me it goes in endless loop. What am I doing wrong?
the script I use is well known from Katie Floyd/ David Spark in around 2010:
tell application "PDFpenPro"
open theFile as alias
tell document 1
ocr
repeat while performing ocr
delay 1
end repeat
delay 1
close with saving
end tell
quit
end tell
Can I change delay to 2 or 3?