diff --git a/src/Test/Target.hs b/src/Test/Target.hs
--- a/src/Test/Target.hs
+++ b/src/Test/Target.hs
@@ -76,13 +76,14 @@
          printf "Testing %s\n" name
        sp  <- getSpec (ghcOpts opts) path
        ctx <- mkContext (solver opts)
-       runTarget opts (initState path sp ctx) (do
-         ty <- safeFromJust "targetResultWith" . lookup (symbol name) <$> gets sigs
-         test f ty)
-        `finally` killContext ctx
+       do r <- runTarget opts (initState path sp ctx) $ do
+                 ty <- safeFromJust "targetResultWith" . lookup (symbol name) <$> gets sigs
+                 test f ty
+          _ <- cleanupContext ctx
+          return r
+        `onException` terminateProcess (pId ctx)
   where
     mkContext = if logging opts then flip makeContext (".target/" ++ name) else makeContextNoLog
-    killContext ctx = terminateProcess (pId ctx) >> cleanupContext ctx
 
 targetResultWithTH :: TH.Name -> FilePath -> TargetOpts -> TH.ExpQ
 targetResultWithTH f m opts = [| targetResultWith $(monomorphic f) $(TH.stringE $ show f) m opts |]
diff --git a/target.cabal b/target.cabal
--- a/target.cabal
+++ b/target.cabal
@@ -1,5 +1,5 @@
 name:                target
-version:             0.2.0.0
+version:             0.2.0.1
 synopsis:            Generate test-suites from refinement types.
 
 description:         Target is a library for testing Haskell functions based on
