How can I force my laptop to shut down when I close the lid?
Though it's less and less true thanks to auto save, a shutdown in general may require user action (e.g., from an application that doesn't use the auto save model, or from an application that is frozen or becomes frozen when the OS tries to quit it). Therefore, any solution would not always work, because if the shutdown requires user interaction to complete, it will not finish (unless you want to do a forced-shutdown, which is a bad idea). 

Also I should point out that this will do the exact opposite of saving energy, since booting the computer takes up a bit of CPU.  The boot time will also make this the exact opposite of convenient.  And due to what I said above, it won't be secure. 

If you care about security, just enable a password when the computer is put to sleep. You can set the computer to shut down automatically at a set time every day in the energy saver preferences, and logout automatically after a given time of inactivity in the security presences (but the screensaver/sleep password is more secure, since logging out won't always work without user interaction either).