Long back I wrote a tip on how to change the start menu power button to shutdown or hibernate. It was set to sleep by default but I rarely use sleep mode and most of the time I either use shutdown or hibernate. Recently, Nirmal mentioned how to shutdown the PC instantly with the power button.
Based on that, here is how to make your laptop to shutdown or hibernate when you close the lid.
From the left side list, find Choose what closing the lid does
Here change the settings that you prefer. You can choose from Do Nothing, Sleep, Hibernate or Shut Down. Also if you prefer to have different setting while your laptop is connected to power supply, you can do so by choosing different options under On battery and Plugged in.
Also you can similarly change the setting of the power button or sleep button to shutdown or hibernate.