Clear the stack and close the active window. This will close your application and not go back to the previous window.
window.ClearStateStack(False) mc.CloseWindow(id)