Fixed bug in the UndoRedoHandler

To reproduce: Start from a new document, draw some strokes,
open another document discarding the strokes
=> The "Undo" button is not greyed out, it offers to undo
the strokes. Should be fixed now