This code is repeated in ImageViewer as _removeViewIfFileDeleted() function. I think you should have a general function in EditorManager since we may have other custom viewers in the future and this should be a general function of EditorManager and not a specific-function of ImageViewer.