How to make my Mac sleep when I close the lid while connected to an external display?
You can simply click on the Apple in your menu bar then click Sleep while leaving it open. This will make both monitors go black. You can close the lid afterwards if you like. Opening the lid or pressing keys on keyboard will awake the device from sleep.

It's just made to go to another monitor when closing the lid as most people only use the external monitor instead of 2 monitors.