if someone closes the SCORM package in the LMS while the separate course window stays open
You might be able to get the course window to close if launch.html is closed... something like this:
var courseWindow = window.open('index_lms.html', 'courseWin', options);
$(window).on('beforeunload', function() {
if(courseWindow) {
courseWindow.close();
}
});
Whether the course window would have enough time to commit data back to the LMS or not is questionable