client close logic simplification