Terminate after writing file.