Warn user when file is already open in another view

This replaces #9181 which fixes #9031.