How to keep all the applications I've opened showing on my external monitor when I close laptop
If you have the displays set to mirrored, they should be identical.

When you disconnect the external monitor, the windows must go somewhere, which is to the built-in display. If it’s mirrored, there can’t be a primary display.