I would prefer not to read through the file twice (even though it will likely be cached).  So unless there is a good argument I'd suggest just appending to key_files as you go.