Hemingway: "You nearly were killed"
I can't tell you exactly why Hemingway wrote it that way as it is about twenty years since I read the novel.
But, in they nearly were killed, nearly qualifies were emphasising the near actuality as opposed to conjecture as to what happened. It could be said in response to the question Could they have been killed?
However, in they were nearly killed, nearly provides a more general qualification of killed emphasising the fact of possible death. It could be in response to the question What happened to them?.