I haven’t followed the link but you probably either have set the same 2 clicks interaction to 2 elements or 2 2 clicks interactions.
So depending on the order of the clicks, one or both your elements end up waiting to close something when the user is going to want to close it.
The good practice is to make 2 one click interactions. One for the opening of the popup, one for the closing. So don’t define a “second click” because when you do that the interaction hangs there and wait for a second click, hence never get reseted to its original state.
So 2 interactions without a second click. The opening one to the open popup link and the second one to close the popup.