fix error handlings properly when processing a large file with disk cache