on modal popup close event code example
Example 1: javascript modal close
$('#closemodal').click(function() {
$('#modalwindow').modal('hide');
});
Example 2: add event listener on modal close
$('#registration-exams-modal').on('hidden.bs.modal', function () {
alert('close');
})