In Lord of the Flies chapter 12, the boys were rescued by the officer. But in a sense Ralph wasn't rescued. Why?
Ralph begins to feel a sense of despair long before the naval officer arrives on the island. His plans to maintain a signal fire, to build shelters, to keep some kind of cohesion and organization amongst the boys slowly unraveled along with his authority.
He also felt a sense of disgust and revulsion at his own penchant for enjoying the thing that Jack used to bring the boys to his side, namely the boys enjoyment of the hunt and the kill. When Ralph participated in a hunt, he noticed his pleasure in it. And then when he'd participated in the murder of Simon he saw where that seemed to lead.
And so in the end, when the naval officer rescues them, "with filthy body, matted hair, and un-wiped nose, Ralph wept for the end of innocence, the darkness of man’s heart, and the fall through the air of the true, wise friend called Piggy."
This loss of innocence was real and deeply felt. Ralph knew now that every one of them was capable of the darkest and ugliest acts of violence imaginable. He might return to a world of "civilization" represented by the officer and the ship but he knew now that it was nothing more than a thin veneer that could be easily cracked.