Try this link. It talks about monitoring the process and then triggering an action like disconnect the session. And there is another link that talks about using a small application called Idle monitor to track if the machine is idle and then runs a script to disconnect the session.