Finalize the notebook