add a close function to pair open