fix usage of couchdb tasks iterator

Change-Id: Ia9b23d52b8a57e2f166928189a77f36a94663837
Reviewed-on: http://review.couchbase.org/25202
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>