improved connection close test