As I know for now there is no any feature to do that in intellij idea. I dont know why but they dont support to do that, at least this is the result which I found with all my researching. Maybe some of us manage this problem with different ways. How do you work with multiple modules in intellij? How should I increase the performance while working with multiple projects?
Closing unused modules in intellij idea like in eclipse?
You can make that module directory as excluded from that project.
Right clicked on the directory, then goto
Mark Directory As -> then click
To Add a module back, click on
Project Structure button, then goto
Modules section, then you can add them back