Pause/Stop Video on Modal Close

I’m using this code below by @bartekkustra from an old entry to stop/pause the embedded video after closing the modal. It works only for the first item in my collection but none of the others. Does anyone know what I can do to resolve this? Thank you!

Read-only Link

<script>
  $(document).ready(function() {
  	// set unique id to videoplayer for the Webflow video element
  	var src = $('#video-id').children('iframe').attr('src');

  	// when object with class open-popup is clicked...
  	$('.open-popup').click(function(e) {
  		e.preventDefault();
  		// change the src value of the video
  		$('#video-id').children('iframe').attr('src', src);
  		$('.popup-bg').fadeIn();
  	});

  	// when object with class close-popup is clicked...
  	$('.close-popup').click(function(e) {
  		e.preventDefault();
  		$('#video-id').children('iframe').attr('src', '');
  		$('.popup-bg').fadeOut();
  	});
  });
</script>

Have you figured out a solution? I’m running into the same issue.