Prevent incomplete task leak in recv.
Normalize tolerance in tests.
Connection failures are 1006 errors, not 1002.
Improve handling of concurrent close from both sides.

This fixes random failures in the test suite.