Fixed tls_read and tls_write to prevent a subsequent crash in SSL_shutdown when read/write errors occur.