A chat ends when the customer closes the chat widget on your website, when they leave your website, the chat will close automatically when there are no new messages sent in a given time.