My guess — and this is a guess — is that if he closes the borders, it opens a (legal) opportunity to use military assets to secure it.
Hint: Presidents in the past have effectively gotten around Posse Comitatus by Executive Order, and we all know how much Trump loves those.