Window close command

Is there a way to run a command when the X button is pressed to close a window?

I see flags for minimize and maximize.. but no close.  Is there a way to do this?

can b achivd usin scriptJob:

win = mc.window()
mc.columnLayout()
mc.showWindow(win)
jNo = mc.scriptJob(uid=[win, 'print "Deleted !!"'])

d scriptJob ll b automatically killd wid closin window i.e; it must b creatd each time d window is created.