Plan9: Killing a process

Before today, I knew of only two ways to kill a process, using kill(1) or slay(1) (and of course, the manual commands they show). Sometimes processes are "stubborn" and won't be killed or slayed. For example, I've been playing around with ssh2 linked from the fqa tweaking it here and there. The last tweak I did compiled fine but I had forgot to group a set of statements in braces, so think that it just did an infinite loop. I attempted to use both kill(1) and slay(1) on the processes, but they refuse to be killed/slayed:

cpu% ps | grep ssh2
glenda        300858    0:00   0:00       84K Pwrite   ssh2
glenda        300864    0:00   0:00       84K Pread    ssh2
glenda        300893    0:00   0:00       76K Mount    ssh2
glenda        300960    0:00   0:00       76K Mount    ssh2
glenda        301028    0:00   0:00       76K Mount    ssh2
glenda        301090    0:00   0:00       76K Mount    ssh2
glenda        301156    0:00   0:00       76K Mount    ssh2
glenda        301225    0:00   0:00       76K Mount    ssh2
glenda        301283    0:00   0:00       76K Mount    ssh2
cpu% slay ssh2
@{echo kill>/proc/300858/ctl} # ssh2
@{echo kill>/proc/300864/ctl} # ssh2
@{echo kill>/proc/300893/ctl} # ssh2
@{echo kill>/proc/300960/ctl} # ssh2
@{echo kill>/proc/301028/ctl} # ssh2
@{echo kill>/proc/301090/ctl} # ssh2
@{echo kill>/proc/301156/ctl} # ssh2
@{echo kill>/proc/301225/ctl} # ssh2
@{echo kill>/proc/301283/ctl} # ssh2
cpu% slay ssh2 | rc
cpu% ps | grep ssh2
glenda        300858    0:00   0:00       84K Pwrite   ssh2
glenda        300864    0:00   0:00       84K Pread    ssh2
glenda        300893    0:00   0:00       76K Mount    ssh2
glenda        300960    0:00   0:00       76K Mount    ssh2
glenda        301028    0:00   0:00       76K Mount    ssh2
glenda        301090    0:00   0:00       76K Mount    ssh2
glenda        301156    0:00   0:00       76K Mount    ssh2
glenda        301225    0:00   0:00       76K Mount    ssh2
glenda        301283    0:00   0:00       76K Mount    ssh2
cpu% 

I read proc(3) and noticed some other commands that could be sent to the ctl file. In order for these processes to be killed, I had to echo closefiles >/proc/300864/ctl; echo closefiles >/proc/300858/ctl, then all of them were killed. It might have been obvious to others what do to in that case, as ps(1) was showing one process was reading and another writing, but I hadn't considered just closing the file descriptors for a process would be needed when kill(1) or slay(1) wasn't working.