fix video glitch when a window is destroyed