Auto - Close Error Box

I used a popup window to display any messages. The popup window has an “openTime” parameter. Then I have an expression to monitor time the message has been open

minutesBetween({Root Container.openTime},now())

If minutesBetween >= 5 then

system.nav.closeParentWindow()