Opening/Closing the Libraries window without using CommandID

I think you’ll need to find your item in the menu bar by name or ID and then use the command. You can get menu bar tree with a script like in this post: