modal on close event code example
Example 1: javascript modal close
$('#closemodal').click(function() {
$('#modalwindow').modal('hide');
});
Example 2: bootstrap 4 modal close event handler
$('#myModal').on('hidden.bs.modal', function (e) {
// do something...
})