Added flush/close/free for the checksum file and watch/backup directories. fixed up error reporting in gen_hash