diff --git a/Codec/Compression/Zlib/Internal.hs b/Codec/Compression/Zlib/Internal.hs
--- a/Codec/Compression/Zlib/Internal.hs
+++ b/Codec/Compression/Zlib/Internal.hs
@@ -420,7 +420,15 @@
                   return $ StreamChunk (S.PS outFPtr offset length) outChunks
           else do fillBuffers defaultDecompressBufferSize inChunks
 
-      Stream.StreamEnd      -> finish StreamEnd
+      Stream.StreamEnd      -> inChunks `seq` finish StreamEnd
+        -- The decompressor tells us we're done, but that doesn't mean we have
+        -- consumed all the input (there could be trailing data). But more
+        -- subtle than that, the decompressor will actually never demand the
+        -- tail of the input (in the usual case where it's empty) because
+        -- the zlib and gzip formats know their own length. So we force the
+        -- tail of the input here because this can be important for closing
+        -- file handles etc.
+
       Stream.Error code msg -> case code of
         Stream.BufferError  -> finish (StreamError TruncatedInput msg')
           where msg' = "premature end of compressed stream"
diff --git a/zlib.cabal b/zlib.cabal
--- a/zlib.cabal
+++ b/zlib.cabal
@@ -1,5 +1,5 @@
 name:            zlib
-version:         0.5.4.0
+version:         0.5.4.1
 copyright:       (c) 2006-2012 Duncan Coutts
 license:         BSD3
 license-file:    LICENSE
