No. There's no solid way of a server detecting if the client has closed their browser. It's just the nature of web development's asynchronous pattern.
if you really wanted to implement this you can try the following solutions,
How to end user session when browser closed[
^]
$(window).on('beforeunload', function(e) {
return "You will now be logged out,";
});
$(window).on('unload', function(e) {
document.cookie = 'hodan_current_cookie=; expires=Fri, 3 Aug 2012 20:47:11 UTC; path=/'
});