finalize script