Motivation:
When we're failing promises on channelInactive, we do so while holding
the write buffer mutably. This means that if anyone calls write() on us,
we'll explode, as we enqueue the write into the buffer.
Modifications:
- Rewrote the close loop to not hold the write buffer mutably.
- Added a regression test.
Result:
No crashes in production.