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

  $(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) {
  		// change the src value of the video
  		$('#video-id').children('iframe').attr('src', src);

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

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