IfI understood correctly, your code will not do what you want because you load one panel, and get multiple (2) references to the same panel and its elements, but they are not multiple instances. So when you close one, you are closing the only panel.
I suggest another approach to get what you want (there can be many other approaches). I think there is no need for classes unless you want to customize each message's behavior too much): just use one panel, and keep the not-shown messages in a list. Each time you click on the "close" button, check if there are more messages to show, otherwise hide it.