fix missed inflateEnd call and enhance handling inflate return value