adding util.async_foreach

which abstracts the idea of running some async function over all the
elements of an array. I've converted a few cases, but there's probably
more in the codebase.