@@ -1972,8 +1972,9 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
string orgname = list.back();
#ifdef WRITEGLOB
- ofstream outstream("filelist.txt",ofstream::app);
+ outstream = ofstream("filelist.txt",ofstream::app);
outstream << orgname << ".dat" << endl;
+ oitstream.close();
#endif
if ( cndir != "" )
{