diff --git a/devlib/module/cgroups2.py b/devlib/module/cgroups2.py
index 83cbf39..a632bbe 100644
--- a/devlib/module/cgroups2.py
+++ b/devlib/module/cgroups2.py
@@ -335,35 +335,28 @@ def _mount_v2_controllers(target: LinuxTarget):
 
     :yield: The path to the root of the mounted V2 controller hierarchy.
     :rtype: str
-    
-    :raises TargetStableError: Occurs in the case where the root directory of the requested CGroup V2 Controller hierarchy 
+
+    :raises TargetStableError: Occurs in the case where the root directory of the requested CGroup V2 Controller hierarchy
         is unable to be created up on the target system.
     """
 
-    path = target.tempfile()
-    
-    try:
-        target.makedirs(path, as_root=True)
-    except TargetStableCalledProcessError:
-        raise TargetStableError("Un-able to create the root directory of the requested CGroup V2 hierarchy")
-        
-        
-    try:
-        target.execute(
-            "{busybox} mount -t cgroup2 none {path}".format(
-                busybox=quote(target.busybox), path=quote(path)
-            ),
-            as_root=True,
-        )
-        yield path
-    finally:
-        target.execute(
-            "{busybox} umount {path} && {busybox} rmdir -- {path}".format(
-                busybox=quote(target.busybox),
-                path=quote(path),
-            ),
-            as_root=True,
-        )
+    with target.make_temp() as path:
+        try:
+            target.execute(
+                "{busybox} mount -t cgroup2 none {path}".format(
+                    busybox=quote(target.busybox), path=quote(path)
+                ),
+                as_root=True,
+            )
+            yield path
+        finally:
+            target.execute(
+                "{busybox} umount {path}".format(
+                    busybox=quote(target.busybox),
+                    path=quote(path),
+                ),
+                as_root=True,
+            )
 
 
 @contextmanager
@@ -379,8 +372,8 @@ def _mount_v1_controllers(target: LinuxTarget, controllers: Set[str]):
 
     :yield: A dictionary mapping CGroup controller names to the paths that they're currently mounted at.
     :rtype: Dict[str,str]
-    
-    :raises TargetStableError: Occurs in the case where the root directory of a requested CGroup V1 Controller hierarchy 
+
+    :raises TargetStableError: Occurs in the case where the root directory of a requested CGroup V1 Controller hierarchy
         is unable to be created up on the target system.
     """
 
@@ -388,33 +381,25 @@ def _mount_v1_controllers(target: LinuxTarget, controllers: Set[str]):
     # its mount path.
     @contextmanager
     def _mount_controller(controller):
+        with target.make_temp() as path:
+            try:
+                target.execute(
+                    "{busybox} mount -t cgroup -o {controller} none {path}".format(
+                        busybox=quote(target.busybox),
+                        controller=quote(controller),
+                        path=quote(path),
+                    ),
+                )
 
-        path = target.tempfile()
-        
-        try:
-            target.makedirs(path, as_root=True)
-        except TargetStableCalledProcessError as err:
-            raise TargetStableError("Un-able to create the root directory of the {controller} CGroup V1 hierarchy".format(controller = controller))
-
-        try:
-            target.execute(
-                "{busybox} mount -t cgroup -o {controller} none {path}".format(
-                    busybox=quote(target.busybox),
-                    controller=quote(controller),
-                    path=quote(path),
-                ),
-            )
-
-            yield path
-
-        finally:
-            target.execute(
-                "{busybox} umount {path} && {busybox} rmdir -- {path}".format(
-                    busybox=quote(target.busybox),
-                    path=quote(path),
-                ),
-                as_root=True,
-            )
+                yield path
+            finally:
+                target.execute(
+                    "{busybox} umount {path}".format(
+                        busybox=quote(target.busybox),
+                        path=quote(path),
+                    ),
+                    as_root=True,
+                )
 
     with ExitStack() as stack:
         yield {
@@ -569,7 +554,7 @@ class _CGroupBase(ABC):
             )
         except TargetStableError:
             self._set_controller_attribute("cgroup", "procs", pid)
-        
+
         else:
             if str(pid) not in member_processes:
                 self._set_controller_attribute("cgroup", "procs", pid)
diff --git a/devlib/target.py b/devlib/target.py
index e82d634..48c0acf 100644
--- a/devlib/target.py
+++ b/devlib/target.py
@@ -1900,12 +1900,11 @@ class LinuxTarget(Target):
             return
         try:
 
-            tmpfile = await self.tempfile.asyn()
-            cmd = 'DISPLAY=:0.0 scrot {} && {} date -u -Iseconds'
-            ts = (await self.execute.asyn(cmd.format(quote(tmpfile), quote(self.busybox)))).strip()
-            filepath = filepath.format(ts=ts)
-            await self.pull.asyn(tmpfile, filepath)
-            await self.remove.asyn(tmpfile)
+            async with self.make_temp(is_directory=False) as tmpfile:
+                cmd = 'DISPLAY=:0.0 scrot {} && {} date -u -Iseconds'
+                ts = (await self.execute.asyn(cmd.format(quote(tmpfile), quote(self.busybox)))).strip()
+                filepath = filepath.format(ts=ts)
+                await self.pull.asyn(tmpfile, filepath)
         except TargetStableError as e:
             if "Can't open X dispay." not in e.message:
                 raise e