correct loops in UpdateNoteCaptions for notes

Change-Id: Icec072eea61a194d72ce00c58dfbd85b1ec85abb
Reviewed-on: https://gerrit.libreoffice.org/7390
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit 20ecc5b59d757307fbc9c3222af2a34ab8fb5bde)
Reviewed-on: https://gerrit.libreoffice.org/7391