closeAndAwait
closes the engine (if it is not closed yet) and suspends until its native resources have been released. A running inference is aborted first, and the release follows once it has left native code. Idempotent: every call, from any coroutine, returns once the release has completed. Cancelling the caller stops the wait, not the release.
Do not call it from a callback the engine invokes while it is running inference, or while collecting one of the engine's own result flows (the release waits for that call or flow to finish, which waits for the caller). There, call close and await the release with closeAndAwait after the collection has ended.