write_file supports file_like objects