There's also a glaring bracket mismatch in that code...
Also, if you started any /timers with that scid $cid command then they would continue to be sent when the connection closes and that could easily explain the problem.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"