Have a popup problem..

I'm creating a custom mobile menu using a popup layer. I have the popup layer locked using (lock) and added a custom close button using popup:close

Now on the popup layer I have two Link to anchor links that go to anchors on the page. Clicking an anchor link on the popup layer goes to the page section fine but the popup layer remains visible blocking the content, ideally I would like the popup layer to close when clicking an anchor link.

I tried selecting Link to anchor option and using popup:close in Link to field but you can't have both at the same time.

Putting "#anchorname popup:close" in the Link to field just makes a broken link with all that text and "popup:close #anchorname" is just popup:close without the link. Would be nice if you could use it this way with anchor links but seems you can't.

Does anyone know a way of closing the popup when clicking an anchor link?