When I close the lid of my Macbook Pro (Lion), it goes to sleep, which is good: it powers down without closing my applications.
But if I just leave the computer unattended for a while without closing the lid, it attempts to shut down instead. It usually fails at this, because there's often a program such as Photoshop (which doesn't use Lion's autosave feature) blocking shutdown with a "Save as" dialog. But it does always succeed, annoyingly, in closing my browser etc. It does this even when the computer is plugged in and fully charged.
When I leave my computer unattended for 15 minutes, I want it to behave exactly as if I had closed the lid: it should go to sleep, not shut down.
How can I do this?