fix(): Go back to beginning of the file before writing