On a similar note I've been looking for a way to put mine to sleep when I close the lid with an external monitor attached. Windows seems to have a lot more options in this area unless I'm missing something
There isn't a built in way. That's not what Apple wants to happen so fuck the user I guess. Someone has written a script that monitors for if the lid is closed and puts it to sleep. I haven't personally tried it though.
https://github.com/pirj/noclamshell