Ensure that rewind is done from latest common checkpoint

This fixes a bug where the rewind could begin at the point of WAL
diversion between the source folder and the folder to be rewinded
and not the last common checkpoint.

Patch by Samrat-Revagade, with some additional comment by me.