fix zlib memory leak

also, _fin_zstream is used only inside one method, so let's define it
there.