write to file final