Added code that removes the views when a model/widget is closed.