Endings are very important. You can enjoy a story all the way up to the end, but sometimes the actual ending will be so bad it retroactively makes you hate the rest of the story.
Many say that the worst ending is “And then I woke up and it was all a dream.”

I disagree. The first rebuttal is Lewis Carroll’s Alice in Wonderland, of course, a dream that still can serve as a fun story. But dreams have an effect on waking life. Dreams bleed over into our day, so if you show how a dream changes a person, you can still have a powerful story. That’s without taking into account the fact that if you want to bend reality a little (as fiction writers are wont to do) then dreams can be really truly real.
No, you know what the worst type of ending is? “Let’s make it so none of this story ever happened.” I suppose we are never told not to use this ending because it should go without saying. It’s also very difficult to do without time travel.
Of course, there are exceptions to every rule, and once I began to think of examples, I did think of one I liked. So let’s look at why they might work, and why they might crash and burn your entire body of work.

Stargate SG1: 2010
Stargate is a sci-fi show where the U.S. Air Force go to other planets through a giant ring called a Stargate. This episode (which aired in the year 2000) takes place in an alternate future, where the team strikes a deal with an advanced species, receiving medical and technological aid and changing Earth society. However, they discover that the medical aid was actually mass sterilisation, and that this advanced species had basically wiped them out and was just waiting for everyone to die. The solution? Send a message back in time to warn ourselves not to meet them in the first place.
Now, this works for me, and is actually one of my favourite episodes of Stargate. They get to play around with a new timeline for an episode, which is fun. One of the reasons I think it works is because there is a followup episode (2001, which aired in 2001), where they encounter the advanced species again, but all they know is they didn’t want to go to that planet. So it shows that despite hitting the reset button, there were consequences here.

Doctor Who: Journey to the Centre of the Tardis
The show about the time-and-space-travelling alien. As the title suggests, the characters spend most of the time looking in the less-travelled areas of the TARDIS, the time-travelling spaceship that is bigger on the inside. The characters back themselves into a corner until the Doctor realises the only way out is to go back in time and make it so it never happened. The problem is that it comes right after a scene where both doctor and companion make discoveries about each others character. The doctor gets to retain his information (or lack thereof), but Clara has no memory of the whole thing and to be honest, that takes her character arc backward a little bit. At least there’s a set up, and I guess the doctor remembering does mean he has new information, hence the episode has consequences of a sort. I will admit to being a little disappointed here, though.

The Dreamers series, David Eddings
AKA the reason I started this blog post. A four book series about a war between some insect hivemind and all the gods and men. The war ends when one character realises he was the all-powerful creator of the universe and just goes and kills the head of the hivemind. Job done. More egregiously, Mr. All-Powerful Creator then changes the timeline so that defeating the hivemind happened many centuries ago, thus undoing the entire war.
Unlike Stargate and Doctor Who, this series is not part of an ongoing episodic story, so there is no chance to revisit this, no chance to face the consequences of changing the timeline. But surely Eddings is smart enough to realise that we like to see our characters grow and change in stories! That’s what stories are for! Apparently not, since the reason given for resetting the timeline is so that one of the main characters, who lost his wife to the insect hivemind, doesn’t have to deal with the loss anymore. I get wanting characters to have a happy ending, but that’s not what the reader wants to see. The reader wants to see the characters get past their sad history, rather than for the sad history to disappear completely.
Seriously, what was the point of me reading four entire books of story when it ends by saying ‘so basically none of that actually mattered’? Because that’s what it feels like. This may have caused me to dislike everything Eddings wrote in retrospect, or at least like it less. Argh.

In summary, be very, very careful when introducing time travel. Don’t write your story out of existence, unless you can create ripples in a larger storyline by doing so. Definitely don’t reset someone’s trauma just to give them a happy ending. Or you will get angry readers like me.