Of course this is just assuming you keep the default of closing the lid => computer goes to sleep. It is possible for some Macs to keep running while the lid is closed, so basically only the display is not powered. It is also possible for some Macs since Mavericks to actually have most of the kernel running to perform background tasks, called Power Nap.
Closed-display mode: https://support.apple.com/en-us/HT201834
Power Nap: https://support.apple.com/en-us/HT204032