Now the close button can be inserted dynamically and will work.