diff --git a/helics.cabal b/helics.cabal
--- a/helics.cabal
+++ b/helics.cabal
@@ -1,5 +1,5 @@
 name:                helics
-version:             0.1.2
+version:             0.1.3
 synopsis:            New Relic® agent SDK wrapper for Haskell.
 description:         
   New Relic® agent SDK wrapper for Haskell.
diff --git a/src/Network/Helics/Foreign/System.hsc b/src/Network/Helics/Foreign/System.hsc
--- a/src/Network/Helics/Foreign/System.hsc
+++ b/src/Network/Helics/Foreign/System.hsc
@@ -10,6 +10,8 @@
 #include <unistd.h>
 #include <sys/times.h>
 
+import Control.Exception
+
 import System.Posix.Types
 import System.Posix.IO.ByteString
 
@@ -37,8 +39,7 @@
 getPages :: CPid -> IO Int
 getPages (CPid pid) = do
     let name = S8.concat ["/proc/", L.toStrict $ L.show pid, "/statm"]
-    fd <- openFd name ReadOnly Nothing defaultFileFlags
-    allocaBytes bufSize $ \ptr -> do
+    bracket (openFd name ReadOnly Nothing defaultFileFlags) closeFd $ \fd -> allocaBytes bufSize $ \ptr -> do
         CSize l <- fdReadBuf fd ptr $ fromIntegral bufSize
         bs      <- U.unsafePackCStringLen (castPtr ptr, fromIntegral l)
         return . maybe 0 fst . S8.readInt . S8.tail . snd $ S8.break (== ' ') bs
