Fix state and high water mark behavior on writable streams.

Fixes #121. Now writable streams behave as expected with respect to their state changing in reaction to the given queuing strategy. See the tests for more details.