Welcome to the Reaper Forum, pulis!
I think I'm not getting what your issue is
Basically, you don't need to disable MIDI devices to keep them from playing. It's a matter of routing the MIDI data to only the respective device and not to all of them. What are the three MIDI devices and how are you using them?
.