Possible event loss when pooled connection is closed before writing, close #768