Some strange and incorrect closed detection logic.

I think this is leftovers from before I figured out the concurrency
model correctly.