Disable offscreen rendering before destroying rendering window, to avoid crash