If you have a sample of size $T$ and are exploring VAR models with up to $P$ lags, the models being compared (VAR($1$), VAR($2$), ..., VAR($P$)) are fitted on the last $T-P$ data points in the sample. When you change $P$, your estimation sample changes, so you are getting different results for the same concrete lag length $p$.
This can be seen from the VARselect
function and anticipated from its help file which says
Based on the same sample size the following information criteria and the final prediction error are computed
(the emphasis is mine).
The effect of the changing estimation sample may be particularly pronounced in small samples (small $T$) and should more or less vanish in larger samples.
How you should select a model in this situation is a tricky question. You should probably fix $P$ first, a decision that should balance the flexibility of the largest model $P$ (you want decent flexibility) vs. the shrinking size of the estimation sample $T-P$ (you want a large estimation sample). Then, for the chosen $P$, choose the model with the lowest value of the relevant information criterion.
I do not have a good explanation for why you get negative infinity in some cases. Perhaps you sample size is so small that a model with a sufficiently high lag fits the data perfectly?