I don't think there's a neat way to do it but I found an ugly one:
http://uk.answers.yahoo.com/question/in ... 533AAbGiLP - that article allows you to schedule a task for when you close the lid (or put the computer to sleep, so this is only useful if you don't use sleep anyway).
You would want to configure these two tasks: "shutdown /s" and "shutdown /f /t 180". The first starts a "graceful" shutdown, the second waits 3 minutes and then forces a shutdown.