You need to return false if the ajax call is not successful. True when it is successful. Also it would probably be good to have the ajax call not be async. See the example below. This example may not fix your problem but it should help you to track it down better if it doesn't fix it.
I have had problems with the onbeforeunload event not always firing. If I remember correctly it doesn't fire if the user closes the browser before the page has fully loaded. I don't believe there is anything that you can do to fix that problem.
function WindowCloseHanlder() {
var success = false;
if (!isClose) {
$.ajax({
type: "GET",
url: "/Account/LogOff",
async: false,
error: function (xhr, ajaxOptions, thrownError) {
success = false;
}
success: function (data) {
success = true;
}
)};
}
return success;
}