Sounds like a loose cable from laptop to lid.
If you have a monitor, try plugging it in. If problem persists it would suggest the graphics chip is failing but if it is OK on the external monitor, it confirms it is a loose cable.
Surface Pro (2017) vs Surface Pro 4
20 groundbreaking 3D animation techniques
How to mine Bitcoin on Mac
Synology invites you to visit them at Insomnia on 26th – 29th August. Book your tickets now and visit Synology.