I believe it's much more complex than extremist terrorism only being a product of immigration. Many of the attackers have been born and brought up in the country of the attack, but have been radicalised by dangerous extremist ideology. The last attack here was by a white extreme racist, who probably had mental health problems. Another attack was by a man of a mixed race/African descent who had converted to radical Islam. Mental health and social problems play a huge role in what's happening over here.
Also I don't think the Brexit vote and recent elections have helped, as it's divided the country even more and lead to more hate crime. The internet is also a huge problem when it comes to radicalisation. And then you have the age old issues of the wars in the middle east and the involvement of West leading to resentments building up, and the messed up ideology of radical Islam and ISIS.
I really don't think these attacks will stop if you shut the borders. I don't believe it's the answer and could make the situation worse by breeding more hatred and intolerance. We need to get to the roots of the problems of radicalisation, social issues in our own countries and the relationships Western countries have with those in the Middle East.
Just my opinion and I don't want to get involved in any arguments