Better handling of files (got rid of WorkWriter, proper disposing of CAFS objects), fixes a memory leak