Ensure there’s nothing magnetic around the laptop. Years ago I had a soft case for my MacBook with a magnetic closure, and I’d pull the laptop out of the case, and set the laptop ON TOP of the case. I was seeing similar behavior because the magnet in the case was triggering the screen open/close sensor.