fix files.py and sql.py to write to the named output file