Fix deregistering of fileNameChange event in ImageViewer

For #9903.