pmap modified to work with any iterable

The modified `pmap` can work with any iterable objects that do not have a known `length` (e.g. data getting read from streams).

Behaves slightly differently though when all elements in the source could not be tried because of any error. The current `pmap` returns a result array of size same as source. This new `pmap` would return a shorter result array of only valid results.

Also addresses a condition where `pmap` may not retry the last entry in the source fails.