Removed redundant usages of onFinished of branch.

Replaced usages of onFinished of branch with usages of afterNextFlush of
collector.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>