[PDFHistory] Prevent the history from getting stuck in certain edge cases