Writing on a CSV -- general question

Hi there! Have a general question on writing .csv files using DictWriter: If at the end of an iteration, we’ve called .writeheader and .writerow on the writer object, NOT on the actual file through its alias name, how do we know we’ve actually written in the new file, i.e. on the actual .csv we created on the with statement?
Thanks in advance for any help!