diff --git a/lib/utils.py b/lib/utils.py
index 7f02e1ad537e3c12f9add305a8d6afe8608ec320..bee53adcfadc24a5355be9eb0dc9f59f7997f2e1 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -2258,7 +2258,7 @@ class FileLock(object):
     """Close the file and release the lock.
 
     """
-    if self.fd:
+    if hasattr(self, "fd") and self.fd:
       self.fd.close()
       self.fd = None