add close function.