private function afterElementWrite(\Exception $error = null, $result = null)
{
$this->iterator->next();
if ($error) {
$this->promisor->fail($error);
} elseif ($this->iterator->valid()) {
$this->writeNextElement();
} else {
$this->promisor->succeed();
}
}