Added 'nfiles' argument to handle_file() so it will produce the standard 20 output files in main mode but can be set differently for unit tests.