Remove relations and models in closeEvent.