First of all, the ending of the novel is ironic for a couple reasons. #1: The boys were rescued because of the fire; however, it was a fire that Jack had set in order to destroy Ralph. Ralph had always emphasized how important the fire was to being rescured, and now when Jack and the savages could care less about going home, they have been rescued by the very thing Ralph said they would.
It is also ironic because they are rescued by an adult Navy officer on a cruiser that is part of the world war that is happening. The Navy officer is disappointed in them for not acting more civilized and because they had really killed people, but isn't that what he is doing?
The ending does seem pessimistic because what are the boys being rescued back to? Yes, they get to go home, but they are going back to a world where adults war with one another. There is no sense that life will be better or that humans will be nicer to each other when they go back home.