csum-file: refactor finalize_hashfile() method