Reset the state properly for new files.