Avoid showing the keep changes/overwrite dialogs when unnecessary.

For #6525 and the issue mentioned in #5614. Essentially, the changes here should make it so that once you've clicked "Keep Changes in Editor" (when the underlying file is externally modified or deleted), you don't get prompted with that dialog again (or with the "Overwrite" dialog on save) unless the file changes on disk again.

@peterflynn - might be good for you to review this one.

I tested all the cases I can think of, but this seems like it would be good to unit test - though I wasn't able to find any existing unit tests for the file sync stuff. Is it worth starting up a new suite?