Rather than do this with a logout script, use the Task Scheduler for this too.
One of the trigger options is for an Event. So in the Triggers tab, create a new trigger, and choose "On an event". then use the following settings:
Log: Security Source: Microsoft Windows security auditing Event id: 4634
Check your event logs, in the security logs to make sure this event ID matches your logoff event and that they are being logged.