The "close" and "resize" buttons of this contraption don't do anything by default, but you can add your own behaviors with scripting.
If you open the properties panel for the MacWindow (double click on it while in Widgets mode) and click "Script..." you'll see the template script of the contraption:
on close do end on resize do end
Fill in "on close ..." to make it hide the contraption:
on close do me.show:"none" end
It's easy to un-hide the window again later in another script:
myMacWindow.show:"solid"
If you really want to destroy the contraption instance when you click the "close" button you can remove it from the deck:
on close do deck.remove[me] end
Does that make sense?