Listens for window iconify and deiconify events, so that it can stop the animation when the window isn't visible.