Merge pull request #6948
22e7807 Always flush block and undo when switching to new file (Pieter Wuille)