MWE
julia> using MIDI, Mplay
julia> mplay(testmidi())
Note retriggered
Note retriggered
julia> mplay(testmidi())
midi: cannot open MIDI output
Julia has exited. Press Enter to start a new session.
So, open the GUI through mplay, and then close it (normally close the window, press the X button at top right). If you try to open mplay again, it doesn't work.