Is 'close_if_idle' always the last call in a function body? (You always transition to sending or disconnecting after calling close_if_idle)?

If so, then this approach is fine, otherwise, the function should return `{ClosedOrNot, NewState#state{}}` and leave it to the caller to decide where to go next.