in reply to Tk & Xwin event order

Why doesn't the 'die' force the WM_DELETE_WINDOW event to be caught?

As far as I know, that's because die is not a window manager event. It's completely outside of Tk's event loop.

You could put an END block in your main code that calls my_exit(). If you do that, you'll need to make sure that it's safe to call that twice or set a flag that you've already called it.