Oh what a pity - the writer did a good job right up to the last sentence, at which point he seems to have completely lost his grip!
I think you are right in your interpretation of what is meant. Also in your understanding of the normal use of 'to keep' when meaning 'to prevent'. And there probably will be exceptions, as there are to most rules of grammar.
So, well done in your analysis. But do I want to rewrite that ending so that it makes sense? Er, no.
Student or Learner