Fix possible exception when debugger opens a new file