-Fix support for calling Close while not ready with handshake.
-Fix support for calling Close while closing.
-Fix so that you don't write while cancelling async task.
Merge branch 'fix-close'