Run cleanup code after a protected block.

finally Cleanup

finally_cleanup.js
const task = "save";
let open = false;
let outcome = "";

try {
  open = true;
  if (task === "skip") {
    outcome = "skipped";
  } else {
    outcome = "done:" + task;
  }
} finally {
  open = false;
}

console.log("task=" + task);
console.log("outcome=" + outcome);
console.log("open=" + open);
finally-cleanup `finally` runs after the `try` block finishes, whether the block used the normal path or left early because of an error.