refactored midiFileOpen() function