Hey buddyel,
I had that same issue with published applications. When users hit "x" it would only disconnect their sessions and would leave it running on the server.
Basically there is a process not closing whenever the end-user closes the application. I had two servers that I had publish out Excel but only one actually logged off the user when they exited the application. I ran them side by side and I noticed that on one it had 3 processes and on the other it only had 2. Everytime I closed out the application with the 3 processes, the extra process would hang. Which caused the app to still run on the server. Anyways, here is what you need to modify in the registry.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI]
"DllName"="seamls20.dll"
"NotifyEvent"="WfshellTwiNotify"
"LogoffCheckSysModules"="ssonsvr.exe"
The "logoffchecksysmodules" is what you are needing to add. I noticed that on our server, ssonsvr would not close and that was causing our hangup with the app.
Hope this helps.