When the user closes an object, Smile sends a close event to the object's script. You handle close with a handler such as:
on close the_object saving whatever
the_object contains a reference to the object being closed, the owner of the script. The continue command is required to have Smile actually close the object.
The saving parameter of the close event is required: a caller script must specify saving no, saving yes or saving ask.
-- do whatever suitable
continue close the_object saving whatever