diff --git a/SimpleSMT.hs b/SimpleSMT.hs
--- a/SimpleSMT.hs
+++ b/SimpleSMT.hs
@@ -126,7 +126,7 @@
 import Data.IORef(newIORef, atomicModifyIORef, modifyIORef', readIORef,
                   writeIORef)
 import System.Process(runInteractiveProcess, waitForProcess)
-import System.IO (hFlush, hGetLine, hGetContents, hPutStrLn, stdout)
+import System.IO (hFlush, hGetLine, hGetContents, hPutStrLn, stdout, hClose)
 import System.Exit(ExitCode)
 import qualified Control.Exception as X
 import Control.Concurrent(forkIO)
@@ -233,7 +233,12 @@
 
          stop =
            do cmd (List [Atom "exit"])
-              waitForProcess h
+              ec <- waitForProcess h
+              X.catch (do hClose hIn
+                          hClose hOut
+                          hClose hErr)
+                      (\ex -> info (show (ex::X.IOException)))
+              return ec
 
          solver = Solver { .. }
 
diff --git a/simple-smt.cabal b/simple-smt.cabal
--- a/simple-smt.cabal
+++ b/simple-smt.cabal
@@ -1,5 +1,5 @@
 name:                simple-smt
-version:             0.7.0
+version:             0.7.1
 synopsis:            A simple way to interact with an SMT solver process.
 description:         A simple way to interact with an SMT solver process.
 license:             BSD3
