User Must not be able to Open More Than 5 Project What Should Be The Custom Code

Please Help, I Only Want User To be Able to Open 5 Project At A Time If A User Close Or cancel One Of the Before Project then Only HE Can Create New Project Otherwise Not .

What Should Be The Custom Script For this