Properly clean up goroutines after compaction.
Inline flush, delegate to central resource manager.

I'm not sure this is perfectly correct, but it's inching closer.

I think the file stuff still needs a lot of work to finish up the
rest.

cbugg: closes bug-384 bug-368