client close functionality api