tls_wrap: propagate errors to write callbacks

fix #6903
fix for @^^