Odd. Do you have the Log out after X minutes of inactivity option enabled, in Security under System Preferences? If not, then...are you trying to lock the computer by Fast User Switching to the login window? It doesn't actually log you out - all this does is puts the computer in a mode that forces you to know the account password to get back in. All your applications SHOULD still be running.