Laptop intermal monitor doesn't activate after unplugging external monitor

I’ve had this problem for several months but it seems worse lately. I use a USB-C external monitor with my laptop lid closed. When I unplug the monitor and open my laptop it normally activates the internal display as expected, but about 10% of the time it stays black and I have to do a hard shutdown. Any ideas on how to diagnose this?