Fix a race on the WaitGroup tracking outstanding request on a StaticTable

This fix is OK, but the logic there is tricky and I'd like to think of a
simpler approach.
Log the entire flush duration
[server] Attempt to flush before shutdown

It's annoying when we shut down in the middle of a flush and leave extra
files around.

There's still a TODO for having a better way of dealing with that when
it does happen.