Before you start configuring this, we recommend reading the article about the general logic of automation rules in Deskie, or watching a short video guide to rules
By default, ended chats reactivate when an agent sends a reply in them. But you can set it up so that chats always end automatically in such cases, and only reactivate once a new message arrives from the customer.

We use this rule ourselves and can vouch for how much easier it's made switching to the next case in such situations.