AJS.dialog2 doesnt hide in Issue List View

Jira 8.5.2, ATLAS 8.0.16

I am using Dialog2 from within a .vm file which gets loaded in a web-panel.

I show the dialog, close it and change to another Issue in the List view (Filter …) , open the dialog again and try to hide it again, the dialog doenst hide anymore. also values inside, that I set are not displayed.
Something seems to get mixed up…

My JS Code is triggered by

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason) {
  var $context = ((typeof context !== 'undefined') ? $(context) : $(''));
  var module = ((typeof context !== 'undefined' && typeof context[0] !== 'undefined') ? context[0].id : '');
  switch(reason) {
    case JIRA.CONTENT_ADDED_REASON.panelRefreshed:
      $context.find('#my_element').each(function() {

Any hints on why this happens and how I can fix it, would be greatly appreciated!

Thanx in advance,