Fix handling of server crashes.
Fix handling of server crashes.

- Mistakenly thought could check for closed channel on writes.
- Did not get rid of stale channel in all shutdown scenarios.

brunchboy/afterglow,ryfow/afterglow,brunchboy/afterglow,brunchboy/afterglow,dandaka/afterglow,ryfow/afterglow,dandaka/afterglow