I easily solved the Problem, I just overwritten the function with selenium.runScript();
selenium.runScript("window.onbeforeunload = null;");
so when before the window gets closed the onbeforeunload is seted to null and nothing will happen, while closing :P.
for me its OK, cause i don't need to test the onbeforeload.