You can do this by adding a button or a label anywhere to close the drop-down menu.
For this you need a trigger and a little script code.
<button class="btn btn-danger kapat" type="submit">Arama</button>
By using this in the Script Code, you can enable the button to be used only in the area where it is found.
$(".kapat").click(function() {
$(this).closest(".dropdown-menu").prev().dropdown("toggle");
});