I think ending with “Happily ever after” is just as important as beginning with “Once upon a time”. It makes a boundary around the story and places it apart from the immediacy that’s around us. They are bookends. The "Once upon a time” takes us to the not-here, not-now, and the “Happily ever after” lets us leave it and come back, by freeing us from wondering how all the loose ends worked out. It’s from the oral tradition apart from books, an equivalent of ceremonially opening the storybook as we start, and closing the book at the end. In theater, we have the house-lights to stage-lights transition, and back again at the end (or the curtain, in the days before such effective dramatic lighting). If you would take people on a journey to a scary place, you must needs bring them back.
More information about text formats