diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9fa0995..0a00e65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
 Referenced versions in headers are tagged on Github, in parentheses are for pypi.
 
 ## [vxx](https://github.com/pydicom/deid/tree/master) (master)
+ - need to clean up temporary directory (mkdtemp), issue #68 (0.1.18)
  - fixing issue #65, save for compressed data (0.1.17)
  - matplotlib must be less than or equal to 2.1.2 for install (0.1.16)
  - fixing bug with clean coordinate flipping rectangle
diff --git a/deid/dicom/pixels/clean.py b/deid/dicom/pixels/clean.py
index b01417e..57e0642 100644
--- a/deid/dicom/pixels/clean.py
+++ b/deid/dicom/pixels/clean.py
@@ -24,10 +24,10 @@ SOFTWARE.
 
 from deid.config import DeidRecipe
 from deid.logger import bot
+from deid.utils import get_temporary_name
 from pydicom import read_file
 import matplotlib
 matplotlib.use('pdf')
-import tempfile
 import os
 import re
 
@@ -52,7 +52,7 @@ class DicomCleaner():
                        force=True):
 
         if output_folder is None:
-            output_folder = tempfile.mkdtemp()
+            output_folder = get_temporary_name(prefix="clean")
 
         if font is None:
             font = self.default_font()
@@ -141,15 +141,25 @@ class DicomCleaner():
 
     def _get_clean_name(self, output_folder, extension='dcm'):
         '''return a full path to an output file, with custom folder and
-           extension
+           extension. If the output folder isn't yet created, make it.
+ 
+           Parameters
+           ==========
+           output_folder: the output folder to create, will be created if doesn't
+           exist.
+           extension: the extension of the file to create a name for, should
+           not start with "."
         '''
         if output_folder is None:
             output_folder = self.output_folder
 
+        if not os.path.exists(output_folder):
+            bot.debug('Creating output folder %s' % output_folder)
+            os.mkdir(output_folder)
+
         basename = re.sub('[.]dicom|[.]dcm', '', os.path.basename(self.dicom_file))
         return "%s/cleaned-%s.%s" %(output_folder, basename, extension)
 
-        
     def save_png(self, output_folder=None, image_type="cleaned", title=None):
         '''save an original or cleaned dicom as png to disk.
            Default image_format is "cleaned" and can be set 
@@ -157,8 +167,8 @@ class DicomCleaner():
            flagged) the cleaned image is just a copy of original
         '''
         from matplotlib import pyplot as plt
-        
-        if hasattr(self,image_type):
+
+        if hasattr(self, image_type):
             png_file = self._get_clean_name(output_folder, 'png')
             plt = self.get_figure(image_type=image_type, title=title)
             plt.savefig(png_file)
diff --git a/deid/utils.py b/deid/utils.py
index 636a454..4af24b1 100644
--- a/deid/utils.py
+++ b/deid/utils.py
@@ -29,7 +29,7 @@ import json
 import os
 import re
 import requests
-import json
+import tempfile
 from deid.logger import bot
 from collections import OrderedDict
 import sys
@@ -40,9 +40,9 @@ if sys.version_info[0] < 3:
     from exceptions import OSError
 
 
-######################################################################################
+################################################################################
 # Local commands and requests
-######################################################################################
+################################################################################
 
 def get_installdir():
     '''get_installdir returns the installation directory of the application
@@ -50,10 +50,30 @@ def get_installdir():
     return os.path.abspath(os.path.dirname(__file__))
 
 
+def get_temporary_name(prefix=None, ext=None):
+    '''get a temporary name, can be used for a directory or file. This does so
+       without creating the file, and adds an optional prefix
+  
+       Parameters
+       ==========
+       prefix: if defined, add the prefix after deid
+       ext: if defined, return the file extension appended. Do not specify "."
+    '''
+    deid_prefix = 'deid-'
+    if prefix:
+        deid_prefix = 'deid-%s-' % prefix
+
+    tmpname = os.path.join(tempfile.gettempdir(), 
+                           '%s%s' % (deid_prefix,
+                                     next(tempfile._get_candidate_names())))
+    if ext:
+        tmpname = '%s.%s' % (tmpname, ext)
+    return tmpname
+
 
-############################################################################
-## FILE OPERATIONS #########################################################
-############################################################################
+################################################################################
+## FILE OPERATIONS #############################################################
+################################################################################
 
 def write_file(filename,content,mode="w"):
     '''write_file will open a file, "filename" and write content, "content"
diff --git a/deid/version.py b/deid/version.py
index da29ba8..e6987c8 100644
--- a/deid/version.py
+++ b/deid/version.py
@@ -1,5 +1,5 @@
 '''
-Copyright (c) 2017 Vanessa Sochat
+Copyright (c) 2017-2018 Vanessa Sochat
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 '''
 
-__version__ = "0.1.17"
+__version__ = "0.1.18"
 AUTHOR = 'Vanessa Sochat'
 AUTHOR_EMAIL = 'vsochat@stanford.edu'
 NAME = 'deid'

Runaway temp folder appears to be leaked for every clean operation.
In clean.py, line 54-55 a temp folder is created and never deleted:

 if output_folder is None:
            output_folder = tempfile.mkdtemp()

The user of mkdtemp() is responsible for deleting the temporary directory and its contents when done with it.
diff --git a/deid/tests/test_utils.py b/deid/tests/test_utils.py
index 9d6fd37..6cc5905 100644
--- a/deid/tests/test_utils.py
+++ b/deid/tests/test_utils.py
@@ -28,6 +28,7 @@ SOFTWARE.
 '''
 
 from deid.utils import get_installdir
+ 
 from numpy.testing import (
     assert_array_equal, 
     assert_almost_equal, 
@@ -52,6 +53,19 @@ class TestUtils(unittest.TestCase):
         shutil.rmtree(self.tmpdir)
         print("\n######################END########################")
 
+    def test_get_temporary_name(self):
+        '''test_get_temporary_name will test the generation of a temporary 
+           file name.
+        '''
+        from deid.utils import get_temporary_name
+        print("Testing utils.get_temporary_name...")
+        tmpname = get_temporary_name()
+        self.assertTrue(not os.path.exists(tmpname))
+        self.assertTrue('deid' in tmpname)
+        tmpname = get_temporary_name(prefix='clean')
+        self.assertTrue('deid-clean' in tmpname)
+        tmpname = get_temporary_name(ext='.dcm')
+        self.assertTrue(tmpname.endswith('.dcm'))
 
     def test_write_read_files(self):
         '''test_write_read_files will test the functions 

pip install -e .
parse_log_pytest
pytest
pylint pydicom pytest
apt-get update apt-get install -y gcc
3.5
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astroid==2.11.7
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
charset-normalizer==2.0.12
cycler==0.11.0
-e git+https://github.com/pydicom/deid.git@f046a885f44f2b65e92b2e31719e95aacc9d059c#egg=deid
dill==0.3.4
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isort==5.10.1
lazy-object-proxy==1.7.1
matplotlib==2.1.2
mccabe==0.7.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pydicom==2.3.1
Pygments==2.14.0
pylint==2.13.9
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
retrying==1.3.4
simplejson==3.20.1
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
typed-ast==1.5.5
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.21.1
validator.py==1.3.0
wrapt==1.16.0
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: deid
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - astroid==2.11.7
      - charset-normalizer==2.0.12
      - cycler==0.11.0
      - dill==0.3.4
      - idna==3.10
      - isort==5.10.1
      - lazy-object-proxy==1.7.1
      - matplotlib==2.1.2
      - mccabe==0.7.0
      - numpy==1.19.5
      - platformdirs==2.4.0
      - pydicom==2.3.1
      - pygments==2.14.0
      - pylint==2.13.9
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.27.1
      - retrying==1.3.4
      - simplejson==3.20.1
      - six==1.17.0
      - tomli==1.2.3
      - typed-ast==1.5.5
      - urllib3==1.21.1
      - validator-py==1.3.0
      - wrapt==1.16.0
prefix: /opt/conda/envs/deid

deid/tests/test_utils.py::TestUtils::test_get_temporary_name
deid/tests/test_utils.py::TestUtils::test_get_installdir deid/tests/test_utils.py::TestUtils::test_recursive_find deid/tests/test_utils.py::TestUtils::test_recursive_find_as_list deid/tests/test_utils.py::TestUtils::test_write_read_files
deid/utils.py deid/version.py CHANGELOG.md deid/dicom/pixels/clean.py
deid/utils.py deid/version.py CHANGELOG.md deid/dicom/pixels/clean.py