In main program, I have a infinite loop, and I need to stop infinite loop when widget is closed by user.