You can make the link invisible, but for the sample, I just disabled them after the popup was closed.
I tested with 3 links just now and it worked perfectly in FF and IE8. The second link opened another popup. The third went to google.com. Upon clicking the back button from the third link, the first and second link were still disabled.
Let me know if you need my updated code.