Rhino8 problem with ActiveViewport

the window in Rhino 8 sticks. and you can see the animation. no such problem in Rhino 7-6. https://youtu.be/MIFtnYri48A

public static bool SaveFile(string filename, bool export = false)
        {
            int num = 0;
            foreach (RhinoObject rhinoObject in RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(true, false))
            {
                num++;
            }

            if (num == 0)
            {
             
                MessageBox.Show("I need to Select a file", "Error", MessageBoxButtons.OK, MessageBoxType.Information);
                
                return false; // No selected objects to save
            }

            FileWriteOptions fileWriteOptions = new FileWriteOptions();
            fileWriteOptions.SuppressDialogBoxes = true;
     

            if (export && num > 0)
            {
                fileWriteOptions.WriteSelectedObjectsOnly = true;
            }

            RhinoView activeView = RhinoDoc.ActiveDoc.Views.ActiveView;
            Rhino.Geometry.Plane plane;
            var siz = activeView.ActiveViewport.Size;
            activeView.ActiveViewport.GetCameraFrame(out plane);

            activeView.ActiveViewport.Size = new System.Drawing.Size(800, 600);
            activeView.ActiveViewport.ZoomExtentsSelected();

            bool success = RhinoDoc.ActiveDoc.WriteFile(filename, fileWriteOptions);

            activeView.ActiveViewport.Size = siz;
            activeView.ActiveViewport.SetCameraLocation(plane.Origin, false);
            activeView.Redraw();
            return success;
        }