Fix Dereferencing _main_window where it could have been null
This fixes a "Dereference before null check" raised by Coverity, it was an error to move the call to opening_file inside draw_trace because draw_trace is not only called when a file just have been opened.