add reason for close function