added TLS support for attach, without considering CloseWrite