ssh hangs on exit

Hi,

Any workaround for this issue, since i am using one script to execute the remote script for several remote server, everything works fine except some of the servers process are hangs even its completed.

---Please help me to resolve this issue----

Script details are here..

for host in `cat host.txt | grep -v '#'`
do
/usr/bin/ssh -x -q prod@$host "
if ( ps -fu prod | egrep '[ /]bounce\\.ksh|[ /]prod_down\\.sh|[ /]PCFN\\.rc' | egrep -v 'grep|ps' )
then
echo \"\\nWARNING:bounce.ksh or prod_down.sh or PCFN.rc is already running. Exiting...\"
else
print -n \"Start at \"; date
. ./.profile 2>&1
bounce.ksh y 2>&1
print -n \"Ended at \";date
fi
" | tee ${host}.log >/dev/null 2>&1 & 
done

This question should be under the scripting section

thanks, will post this to script scection