Problem: after reader closes, WRITE asserts

No semantics were defined for WRITE on a pipe with closed reader.
Solution: writing on pipe where reader closed its send causes an
error. Handled in state machine with new pipe_shut event in the
'processing write' state.

Added test case for #39.

Fixes #39.