net/tls: Fixed race condition in async encryption