Er... you already can open it. That functionality is there. There is no functionality to close it.
I know you mentioned AI assisted code, but honestly, it sounds like you just shoved the problem at AI and went with whatever it spat out, without bothering to do the slightest bit of testing.