diff --git a/tests/test_expcodes.m b/tests/test_expcodes.m
index a0cfdc00b716cd3fffb9c3b5193b5b4a8d822fef..6d9930a118e320d6064dcce915e8a69e930bcfa2 100644
--- a/tests/test_expcodes.m
+++ b/tests/test_expcodes.m
@@ -15,6 +15,8 @@ classdef test_expcodes < matlab.unittest.TestCase
       testCase.addTeardown(@cd,pwd);
       testCase.addTeardown(@path,path);
       
+      testCase.addTeardown(@() SCDclass_expcode.close_all(0))
+      
       basePath = fullfile(fileparts(mfilename('fullpath')),'..');
       run(fullfile(basePath,'rtccode_paths'));