It's possible with native FM tools.
Add a global number field, default 0. [zc_closeWindow_gn]
Add a script along these lines:
Prevent close window:
If( yourTableName::zc_closeWindow_n = 0 )
Show Custom Dialog ( yourText why user can't use the stop light )
Halt scriptEnd If
If( yourTableName::zc_closeWindow_n = 1 )
Close Window ( Current Window )
End If
Exit script
In File --> File Options
Go to tab Script Triggers
Link the script to "OnWindowsClose"
Find a way to set the global field to 1 when needed or authorized.
Something like a close Window button on your layout.
Put a Set Field line in the script linked to that button that sets the zc_ field to 1,
call the Prevent close window script, reset the global to 0
Or tweak the script with a variable.
Hope this helps
JW