diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cc43a5a9719687566b48b3348d6cf4c662c07018..92cb04a711f882e5303d4a5c96f0e195b1dfce3f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -171,10 +171,10 @@ test:3.9:
   <<: *test_template
 
 
-test:3.10:
-  stage: test
-  image: pauldmccarthy/fsleyes-py310-wxpy4-gtk3
-  <<: *test_template
+# test:3.10:
+#   stage: test
+#   image: pauldmccarthy/fsleyes-py310-wxpy4-gtk3
+#   <<: *test_template
 
 
 test:build-pypi-dist:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 1d1ae7c2123250837e0a6e0b705f828a7ff91e55..2bc89f66edcd4c40216443cf517fee1f6a5b9c97 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -2,8 +2,8 @@ This document contains the ``fslpy`` release history in reverse chronological
 order.
 
 
-3.8.0 (Under development)
--------------------------
+3.7.1 (Friday 12th November 2021)
+---------------------------------
 
 
 Changed
@@ -11,7 +11,15 @@ Changed
 
 
 * BIDS and ``dcm2niix`` ``.json`` sidecar files with control characters
-  are now accepted.
+  are now accepted (!312).
+
+
+Fixed
+^^^^^
+
+
+* Fixed an issue with temporary input files created by :mod:`fsl.wrappers`
+  functions not being deleted (!313).
 
 
 3.7.0 (Friday 20th August 2021)
@@ -23,7 +31,7 @@ Added
 
 
 * New :mod:`fsl.wrappers.fsl_sub` wrapper function for the ``fsl_sub``
-  command.
+  command (!309).
 
 
 Changed
@@ -32,19 +40,19 @@ Changed
 
 * Performance of the :mod:`.imglob`, :mod:`.imln`, :mod:`imtest`, :mod:`.imrm`
   and :mod:`.remove_ext` scripts has been improved, by re-organising them to
-  avoid unnecessary and expensive imports such as ``numpy``.
+  avoid unnecessary and expensive imports such as ``numpy`` (!310).
 * The default behaviour of the :func:`fsl.utils.run.run` function (and hence
   that of all :mod:`fsl.wrappers` functions) has been changed so that the
   standard output and error of the called command is now forwarded to the
   calling Python process, in addition to being returned from ``run`` as
   strings. In other words, the default behaviour of ``run('cmd')``, is now
   equivalent to ``run('cmd', log={"tee":True})``. The previous default
-  behaviour can be achieved with ``run('cmd', log={"tee":False})``.
+  behaviour can be achieved with ``run('cmd', log={"tee":False})`` (!309).
 * The :func:`fsl.utils.run.run` and :func:`fsl.utils.run.runfsl` functions
   (and hence all :mod:`fsl.wrappers` functions) have been modified to use
   ``fsl.wrappers.fsl_sub`` instead of ``fsl.utils.fslsub.submit``. This is an
   internal change which should not affect the usage of the ``run``, ``runfsl``
-  or wrapper functions.
+  or wrapper functions (!309).
 
 
 Deprecated
@@ -53,10 +61,10 @@ Deprecated
 
 * :class:`fsl.utils.fslsub.SubmitParams` and :func:`fsl.utils.fslsub.submit`
   have been deprecated in favour of using the ``fsl.wrappers.fsl_sub`` wrapper
-  function.
+  function (!309).
 * The :func:`fsl.utils.fslsub.info` function has been deprecated in favour of
   using the ``fsl_sub.report`` function, from the separate `fsl_sub
-  <https://git.fmrib.ox.ac.uk/fsl/fsl_sub>`_ Python library.
+  <https://git.fmrib.ox.ac.uk/fsl/fsl_sub>`_ Python library (!309).
 
 
 3.6.4 (Tuesday 3rd August 2021)
diff --git a/fsl/wrappers/wrapperutils.py b/fsl/wrappers/wrapperutils.py
index ac647674bfa4c1161f8b5e8ed62e8268a9940518..8a5fa0eb424230684c2af013aed8f0479384cb11 100644
--- a/fsl/wrappers/wrapperutils.py
+++ b/fsl/wrappers/wrapperutils.py
@@ -1046,9 +1046,16 @@ def fileOrImage(*args, **kwargs):
 
             # in-memory image - we have
             # to save it out to a file
-            if infile is None:
-                hd, infile = tempfile.mkstemp(fslimage.defaultExt())
+            if infile is None or not op.exists(infile):
+                hd, infile = tempfile.mkstemp(fslimage.defaultExt(),
+                                              dir=workdir)
                 os.close(hd)
+
+                # Create a copy of the input image and
+                # save that, so the original doesn't
+                # get associated with the temp file
+                val = nib.nifti1.Nifti1Image(
+                    np.asanyarray(val.dataobj), None, val.header)
                 val.to_filename(infile)
 
         return infile
@@ -1110,7 +1117,7 @@ def fileOrArray(*args, **kwargs):
         infile = None
 
         if isinstance(val, np.ndarray):
-            hd, infile = tempfile.mkstemp('.txt')
+            hd, infile = tempfile.mkstemp('.txt', dir=workdir)
             os.close(hd)
             np.savetxt(infile, val, fmt='%0.18f')
 
@@ -1176,6 +1183,7 @@ def fileOrText(*args, **kwargs):
         if not isinstance(val, pathlib.Path):
             with tempfile.NamedTemporaryFile(mode='w',
                                              suffix='.txt',
+                                             dir=workdir,
                                              delete=False) as f:
                 f.write(val)
                 infile = f.name
diff --git a/tests/test_wrappers/test_wrapperutils.py b/tests/test_wrappers/test_wrapperutils.py
index e8acaf135e77899a2aaf6631fdc684a65f15b6c8..d3ac883decdcf3fda47e84383f5d134dbf492d02 100644
--- a/tests/test_wrappers/test_wrapperutils.py
+++ b/tests/test_wrappers/test_wrapperutils.py
@@ -876,3 +876,61 @@ def test_cmdwrapper_cmdonly_assert():
         assert func()[0].strip() == 'hello'
         os.remove('file')
         assert func(cmdonly=True) == ['echo', 'hello']
+
+
+def test_fileOrArray_all_tempfiles_cleared():
+
+    tempfiles = []
+
+    @wutils.fileOrArray('in_', 'out')
+    def array(in_, out):
+        tempfiles.extend((in_, out))
+        i = np.loadtxt(in_)
+        i = i + 1
+        np.savetxt(out, i)
+
+    arr    = np.array([[1, 2], [ 3, 4]])
+    arrout = array(arr, wutils.LOAD).out
+
+    assert np.all(np.isclose(arrout, arr + 1))
+    assert len(tempfiles) == 2
+    assert not any(op.exists(f) for f in tempfiles)
+
+
+def test_fileOrImage_all_tempfiles_cleared():
+
+    tempfiles = []
+
+    @wutils.fileOrImage('in_', 'out')
+    def image(in_, out):
+        tempfiles.extend((in_, out))
+        i = nib.load(in_)
+        i = nib.Nifti1Image(i.get_fdata() + 1, np.eye(4))
+        i.to_filename(out)
+
+    arr    = np.array([[1, 2], [ 3, 4]])
+    img    = nib.nifti1.Nifti1Image(arr, np.eye(4))
+    imgout = image(img, wutils.LOAD).out
+
+    assert np.all(np.isclose(imgout.get_fdata(), img.get_fdata() + 1))
+    assert len(tempfiles) == 2
+    assert not any(op.exists(f) for f in tempfiles)
+
+
+def test_fileOrText_all_tempfiles_cleared():
+
+    tempfiles = []
+
+    @wutils.fileOrText('in_', 'out')
+    def text(in_, out):
+        tempfiles.extend((in_, out))
+        with open(in_, 'rt') as inf, open(out, 'wt') as outf:
+            outf.write(inf.read())
+            outf.write('456')
+
+    txt    = '123'
+    txtout = text( txt, wutils.LOAD).out
+
+    assert txtout == '123456'
+    assert len(tempfiles) == 2
+    assert not any(op.exists(f) for f in tempfiles)