Panel: Check if modal exists before assigning or removing classes. fixes error when dismissible = false