diff --git a/applications/gui2/src/views/addsource.cpp b/applications/gui2/src/views/addsource.cpp
index c8d62aac5ee5c790c21ccc7c41e34349183dfffb..3f9ad3ba0629be3074cecae40b5a122416c9573d 100644
--- a/applications/gui2/src/views/addsource.cpp
+++ b/applications/gui2/src/views/addsource.cpp
@@ -137,8 +137,8 @@ nanogui::Button *AddSourceWindow::_addButton(const std::string &s, nanogui::Widg
 	button->setTooltip(s);
 
 	button->setCallback([this, uri = s, hide]() {
-		ctrl_->add(uri);
 		if (hide) close();
+		ctrl_->add(uri);
 	});
 
 	return button;