if line:sub(-3) == 'new' then
             local new = io.popen("find " .. line .. " -type f -not -name '.*' -printf a")
             cnt_new = string.len(new:read("*all"))
+            new:close()
             if cnt_new > 0 then
                 boxes[acc][box]['cnt_new'] = string.format("${color e6db74}%5d${color}", cnt_new)
             else
         elseif line:sub(-3) == 'cur' then
             local old = io.popen("find " .. line .. " -type f -not -name '*:2,*S*' -printf a")
             cnt_old = string.len(old:read("*all"))
+            old:close()
             if cnt_old > 0 then
                 boxes[acc][box]['cnt_old'] = string.format("${color fd971f}%2d${color}", cnt_old)
             else
             end
         end
     end
+    dirs:close()
 
     newmail = ""
     local accounts = {"gmail"}