Help. Why does this script fail when the target OO doc is not already open?

The Applescript below tries to copy a Safari URL to an OO outline. It works fine if the outline is already open. It fails if the outline is not already open. After the failure the outline has been opened, but the URL hasn’t been copied.

Is this a timing problem, or something else? I am a complete novice at Applescript. My vague memory is that the failure is new with OS X 10.14

The exact error is < error “Can’t get row named “Inbox” of missing value.” number -1728 from « class OOrw» “Inbox” of missing value>

The script is

– clip active safari url as a child of refRowName in OO document outlineName

property refRowName : “Inbox”
property outlineName : “2019-04 Europe”

property filePath : “Users:mrtn:OmniPresence:Omni Notebooks:”

tell application “Safari”

tell current tab of window 1 to set {theURL, theTitle} to get {URL, name}

end tell

tell application “OmniOutliner”

set Doc to open filePath & outlineName & ".ooutline"

tell Doc
	set refRow to row named refRowName
	set newChild to make new row at refRow
	tell newChild
		set topic to theTitle
		set topic cell's text's style's attribute "link"'s value to theURL
	end tell
end tell

end tell

Correction - the failure occurs when OO is not running when I run the script. It works correctly if OO is running, whether or not the target OO outline is open. (Also apologies for the script formatting in my first message)