Make use of a change to netlib.tcp that clarifies error conditions for flush and close.

Should fix #144.