bugfix: properly exit interruptwriter if interrupted

This avoids an assertion failure about the buffer still
being empty when the interruptwriter thread is woken up
for exiting