Test write to file.