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.