Fix problems with DeflaterSink.

We weren't checking Deflater.needsInput() in the deflate loop. This is
necessary on the RI, which returns 0 even when a subsequent call will
deflate data.
Merge pull request #629 from square/jwilson_0310_deflatersink_close

Fix problems with DeflaterSink.