fix zhash_foreach behavior

Currently, zhash_foreach won't stop on non-zero return from zhash_foreach_fn. This is cause by having it only break from internal while loop (items with keys that produce the same hash index), while outer foreach continues. One option could be to add another if statement into the foreach loop, but that seemed slow. Feedback welcome.