Improved Undo/Redo

Made it so undoManager resets when file saved, new file is created, or
new file is opened, so edits are contained in the file you're working
on.