defer Keyword
Defer is used to ensure that a function call is performed later in a program’s execution, usually for purposes of cleanup. defer is often used where e.g. ensure and finally would be used in other languages.
The canonical examples are unlocking a mutex or closing a file.
...