finalize documents