diff --git a/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java b/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java
index ba8f3dfe80588e44759a04f1ae09e0778523bc56..f90778dfd0b76d04c176fa6dc6aafc8e73fd2942 100644
--- a/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java
+++ b/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java
@@ -262,8 +262,9 @@ public class AuthenticatedDispatcher implements Dispatcher {
 		ws.disposeClosedWindows(ureq);
 		Window window = ws.getWindow(ureq);
 		if (window == null) {
-			//probably a 
-			if(usess.isSavedSession() && !usess.getHistoryStack().isEmpty()) {
+			if(request.getPathInfo() != null && request.getPathInfo().contains("close-window")) {
+				DispatcherModule.setNotContent(request.getPathInfo(), response);
+			} else if(usess.isSavedSession() && !usess.getHistoryStack().isEmpty()) {
 				redirectToDefaultDispatcher(request, response);
 			} else {
 				DispatcherModule.sendNotFound(request.getRequestURI(), response);
diff --git a/src/test/java/org/olat/selenium/page/user/UserProfilePage.java b/src/test/java/org/olat/selenium/page/user/UserProfilePage.java
index d40714a8a1a6cb20a7fee7923791eef4ed01b608..b2f31b4059f843f4902efb12e4a72956c80c55a5 100644
--- a/src/test/java/org/olat/selenium/page/user/UserProfilePage.java
+++ b/src/test/java/org/olat/selenium/page/user/UserProfilePage.java
@@ -46,7 +46,12 @@ public class UserProfilePage {
 	 */
 	public UserProfilePage assertOnProfile() {
 		By profileSegmentBy = By.cssSelector("div.o_segments a.btn.o_sel_usersettings_profile");
-		OOGraphene.waitElement(profileSegmentBy, 5, browser);
+		try {
+			OOGraphene.waitElement(profileSegmentBy, browser);
+		} catch (Exception e) {
+			OOGraphene.takeScreenshot("Assertonprofile", browser);
+			throw e;
+		}
 		WebElement profileSegmentEl = browser.findElement(profileSegmentBy);
 		Assert.assertTrue(profileSegmentEl.isDisplayed());
 		return this;