diff --git a/ghc/lib/std/PrelHandle.lhs b/ghc/lib/std/PrelHandle.lhs
index 8d02b32869a7b0ae5cb72b50c56bf94843635ead..1731cbf4ce8e2ff48951b301f97344f2a27dd9f3 100644
--- a/ghc/lib/std/PrelHandle.lhs
+++ b/ghc/lib/std/PrelHandle.lhs
@@ -392,11 +392,16 @@ hClose handle =
              is finalized. (we overwrite the file ptr in the underlying
 	     FileObject with a NULL as part of closeFile())
 	  -}
-          if rc == (0::Int)
-	   then return (handle_{ haType__   = ClosedHandle,
-			         haFO__     = nullFile__ })
-           else constructErrorAndFail "hClose"
 
+          if (rc /= 0)
+           then constructErrorAndFail "hClose"
+
+		  -- free the spare buffers (except the handle buffer)
+		  -- associated with this handle.
+	   else do freeBuffers (haBuffers__ handle_)
+		   return (handle_{ haType__    = ClosedHandle,
+			            haFO__      = nullFile__,
+				    haBuffers__ = [] })
 \end{code}
 
 Computation $hClose hdl$ makes handle {\em hdl} closed.  Before the