Fix bug in pipe; thanks @Raynos.

It wasn't re-checking writableness after each write.