openFile function in main window