Fix error when socket closes during deflate