# runtime/on-shutdown Register a zero-arg callable to be invoked at VM shutdown, before any state is torn down. Used to deterministically close long-lived native resources (DB handles, sockets) that would otherwise rely on GC finalizers. ## Syntax
[runtime/on-shutdown $fn]
## Parameters - `$fn` — zero-arg callable (closure, native-func, keyword, etc.); `nil` is silently ignored ## Examples
def close-db {|| [db/close $conn]}
[runtime/on-shutdown close-db]
## Returns `nil`. Handlers run in registration order; errors are swallowed. ## See Also `defer`, `runtime/destroy`