In Kotlin, a coroutine can be abandoned by not resuming it. If a coroutine is abandoned while suspending in a try-block with finally, the finally clause will not be executed until the coroutine is collected.
For example, the following Kotlin code
val seqWithFinally = sequence {
try {
yield(Unit)
yield(Unit)