diff --git a/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx b/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx
index 096d89436edcdb07382d1c80075f7dcc110ac3f4..39279e3f3d907542092b124f60f48af19a6ac0a5 100644
--- a/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx
+++ b/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx
@@ -128,6 +128,7 @@ int otbNormalizeAttributesLabelMapFilter(int argc, char * argv[])
     }
   outfile << std::endl;
   }
+  outfile.close();
 
   return EXIT_SUCCESS;
 }