call the end_callback when receiving the 'close' event to gracefully handle error cases