Maybe window.onbeforeunload will be helpful here. It executes Javascript when the user leaves the page.
Meteor:
Meteor.startup(function(){ $(window).bind('beforeunload', function() { closingWindow(); });});closingWindow = function(){ ...}
React:
componentDidMount() { window.addEventListener('beforeunload', this.handleLeavePage);}componentWillUnmount() { window.removeEventListener('beforeunload', this.handleLeavePage);}handleLeavePage() { ...}