After some playing around I started thinking that I can most likely manipulate the buttons and use those to close the window. I took fairly easy way out and set following script to OK button
Set Function(Function({this},
((this << top parent) << On Close(1)
)))
You cannot simply set this by right clicking, but you can right click around and find one Show Properties -> Find the correct button box from the list and then set some simple action to Press
after setting something to the press you can right click on the button and modify script it runs
Then Set Script which will modify the modal windows on close to return always 1, press OK and modal will close