I had a similar issue. i changed the resolution on my external monitor when the lid was closed to a level the monitor didn't support (not intentionally). There was no way that I could find to reset the resolution back to something supported (multiple questions here, none of the solutions worked for me - reset NVRAM, SMC, or key strokes with blank screen to change display preferences). I also tried use Automator to reset the display preferences, but couldn't get that to work with lid closed either.
Note that the external monitor was fine when the lid was open. However, changing display settings for the monitor with lid open did not persist when the lid was closed.
I eventually found a way to do it from the terminal command line:
- Install screenresolution utility using Homebrew:
brew install screenresolution
2.Get the resolutions of the currently connected monitors:
screenresolution get
2020-09-05 13:47:12.444 screenresolution[3330:48127] starting screenresolution argv=screenresolution get
2020-09-05 13:47:12.470 screenresolution[3330:48127] Display 0: 1680x1050x32@0
2020-09-05 13:47:12.470 screenresolution[3330:48127] Display 1: 1920x1080x32@60
3.The external monitor is Display 1, so wrote the following command but did not press enter
screenresolution set 1920x1080x32@60
4.Close lid, wait for error to show on the monitor, then press enter on external keyboard.
After a second or so the display settings change took hold and I could use the monitor again.
Hope that helps someone. I couldn't find this specific solution anywhere else, but pieced it together from some other hints and tips.