(defer ..body)
  body: zero or more forms

Defers evaluation until the end of the current lexical scope.

defer may appear anywhere that let can appear. The body forms aren't executed until the defer form goes out of scope, whether that occurs because of normal execution, restart-block, finish-block, return, macro-no-op, or an error.

You can think of defer as working like Drop in Rust.

See also: defer-yield