zlib: do not crash on write after close

fix #7767

Signed-off-by: Fedor Indutny <fedor@indutny.com>