One thing I never understand: if people want to come to your country, that is a vote for the idea that you are doing something right. So, why not use for good? Why not designate a area of the country for the immigrants to initially settle in, using your laws and structures to provide them a better way to live? They are usually very hungry to work. Or, why not band up with other countries to establish refuge cities where the immigrants can initially settle and build new lives?
You never hear of the US etc investing in infrastructure in African countries, for e.g., it is always about a militarization effort to contain supposed terrorists.
Keeping people out betrays that your "success" is built on the back of exfiltrating resources from around the world and concentrating it in your countries, thus keeping the rest of the world poor.