ZSH - '.zlogout' not being run on exit

Hi,

I have a problem with '.zlogout' not being run on Solaris 10.
Here's whats happening.
I remotely log in from a PC running Cygwin/X using a local xterm window and ssh to start a remote 'zsh' shell, version 4.2.5, on a Solaris 10 server.

The Server has KDE installed but as a Window manager is already running on the PC it cannot start KDE correctly. This does not give me a problem as the first xterm which connects to the server will also start 'kicker', the KDE menu bar, which allows me to access all the KDE programs that I need.

I have written a '.zlogout' script which will check to see if there are any 'zsh' sessions remaining. If there are not then it should kill any 'kicker' processes that I own.

The problem comes when I log off the server. The '.zlogout' script does not appear to be run leaving the 'kicker' process running.
I have run the .'zlogout' script manually from a ksh session after starting 'kicker' and it kills it off correctly, therefore there does not appear to anything wrong with the '.zlogout' script itself.

I have set $ZDOTDIR to the directory containing the '.zlogout' script and also placed an 'ls' command with the output re-directed to a file but nothing is being output, which leads me to believe that the '.zlogout' script is not being called.

Does anyone has any ideas of what may be wrong ?

This is the contents of the '.zlogout' file:

#!/usr/bin/zsh
ls -l > /tmp/t1    
xterm_cnt=$( ps -fu $USER | grep -v grep | grep -wc zsh )
if (( ${xterm_cnt} <= 1 )) ; then
    pkill -U ${USER} kicker
fi