Watch 4 idle, is a small windows app that can issue commands or run any application when your machine idles or after any set amount of time.
If the system is idle for say 5 minutes, you can have this close all running programs and log off, close just an email client, or even launch a new application or bat file.
I use it on a quiz machine to close any running apps and return to the main menu after 5 minutes of inactivity, this is especially useful when the kids leave angry birds running!
The uses and permutations are vast.
Get it here: W4IInstall