How to Close Custom Input Window?

Hi I’m somewhat new to UI Path Studio, and in this automation I’m working on I’d like to have a dialog window with a select dropdown open up, and then when the user clicks the “submit” button, I’d like the dialog window to close. I tried adding “window.close()” to the script but that doesn’t seem to be working. This is the html in the file I’m using:

<html>
<body>
	<select id="sites">
		<option value="ziprecruiter">ZipRecruiter</option>
		<option value="indeed">Indeed</option>
	</select>
	<button onclick="SubmitValues()">Submit</button>

	<script type="text/javascript">
	  function SubmitValues(){
            var Site = document.getElementById("sites").value;
            window.external.setResult(Site);
            window.close();
            return true;
          }
	</script>
</body>
</html>

Have you tried the ‘Close Window’ activity? Am I understanding the requirement correctly? Please let me know.