diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py
index a115f5c408498c73d98ec86ef7940f30a2a9de8a..1ef38ef34e4107ce734e0be2ccebdf40ca9f1114 100644
--- a/src/modules/bootloader/main.py
+++ b/src/modules/bootloader/main.py
@@ -106,7 +106,6 @@ def create_systemd_boot_conf(uuid, conf_path, kernel_line):
     with open(conf_path, 'w') as f:
         for l in lines:
             f.write(l)
-    f.close()
 
 
 def create_loader(loader_path):
@@ -126,7 +125,6 @@ def create_loader(loader_path):
     with open(loader_path, 'w') as f:
         for l in lines:
             f.write(l)
-    f.close()
 
 
 def install_systemd_boot(efi_directory):
diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py
index bc43475b654560fe4c1a11c0e35c4e0897c4c711..1dac7b62f40456e539c9b9caffd7666bc0d02524 100644
--- a/src/modules/unpackfs/main.py
+++ b/src/modules/unpackfs/main.py
@@ -264,18 +264,14 @@ def run():
         fs_is_supported = False
 
         if os.path.isfile(PATH_PROCFS) and os.access(PATH_PROCFS, os.R_OK):
-            procfile = open(PATH_PROCFS, 'r')
-            filesystems = procfile.read()
-            procfile.close()
-
-            filesystems = filesystems.replace("nodev", "")
-            filesystems = filesystems.replace("\t", "")
-            filesystems = filesystems.splitlines()
-
-            # Check if the source filesystem is supported
-            for fs in filesystems:
-                if fs == sourcefs:
-                    fs_is_supported = True
+            with open(PATH_PROCFS, 'r') as procfile:
+                filesystems = procfile.read()
+                filesystems = filesystems.replace("nodev", "").replace("\t", "").splitlines()
+
+                # Check if the source filesystem is supported
+                for fs in filesystems:
+                    if fs == sourcefs:
+                        fs_is_supported = True
 
         if not fs_is_supported:
             return "Bad filesystem", "sourcefs=\"{}\"".format(sourcefs)