Waiting for a document to be closed with AppleScript

I have an Automator Workflow that runs a shell script, then it opens an OmniPlan.

Now, I want it to wait for the document to be closed, after which I will run another shell script.

I’ve seen examples of Applescripts that wait for an application to quit, but how can I instead wait only for this specific document to be closed?

pseudo-code:

tell Application OmniPlan
repeat while document “/User/Home/File.oplx” is open
delay 1
end repeat
end tell