To answer your original question, you can hook the Interface Options Frame OnHide script/widget:
Lua Code:
InterfaceOptionsFrame:HookScript("OnHide", function()
-- do stuff
end)
I use this to get around taints involved with Blizzard's provided "cancel" function in the options api.