Close the file after writing the init message.