Found this nice little tool called ScriptSaver today. Basically, when the screen saver in Mac OS X is activated and/or deactivated it will run an AppleScript. The AppleScript can call a shell script or you can write an application in AppleScript and choose it from within the script.
The developer has also made some sample AppleScripts available for use with ScriptSaver. For my purpose I just wanted to kill Safari, so I used an AppleScript of:
tell application "Safari"
quit
saving no
end tell
However, I could have just as easily have used