Macbook swaps external displays when lid closed or opened I have a Macbook Pro connected to two external displays via a docking station.  With the lid open, it will use all three, with the primary set to one of the external displays, let's say display 1.  If I close the lid, the internal display shuts off, which is great.  However display 2 now becomes primary, and all the windows on display 2 move to display 1 and vice versa.  I open the lid, and it switches back.  Not that big a deal just a mild annoyance, but I have not found any information about how to make it stop.
Catalina 10.15.6, MacBook Pro 15 inch 2018
Radeon Pro 560X 4GB
Intel UHD Graphics 630 1536 MB
You need to set the display layout in each scenario. For example set the display arrangement when the macbook screen is opened and you should do it once again for when the laptop display is shut.
That should do the trick.