Close Specific Pop-Up

Hey folks,   Wondering if any of you know how to close a specific pop-up that isn’t necessarily the top of the page stack? I’ve tried targeting the close button on the pop-up I want to close, and I’m able to effectively target it using JS, but clicking it results in closing the page at the top of the page stack – not the pop-up I was targeting. Any work arounds, tips, or advice would be greatly appreciated!
1 answers

Is the JS targeting the specific popup (through ID) or is it using a generic reference (fe by class name .modal)?