RFC: add `finalize` function

Should be self-explanatory.