A campaign might have a well-planned, emotionally resonant ending that executes perfectly, or the group might die in a ridiculous fashion at the worst time possible. The ending doesn't always match the idea you had in your head at the start of the campaign. Check in with your group, especially when you're getting close to the end of each adventure, to see how long they want the campaign to go on and if they're still having fun. Check in with yourself, too, and express your opinion to the other players. Ideally, you know at least a session in advance that the end is coming, allowing you to prepare for a thrilling conclusion. You might plan for the final session's gameplay to be a bit shorter—possibly just one big showdown—to allow time for an epilogue and for the group to reminisce and decompress at the end.
An epilogue can make the end of a campaign more fulfilling. First, let the group finish out their roleplaying in the final moments of the adventure until they're content. Then tell the group the results of what they accomplished in broad terms, with concrete details of what happens to certain places or allied
NPCs. Ask the players what their characters do after the adventure. You might want to narrate a few short scenes. When your epilogue is done, thank everyone for playing. If the campaign ended in success for the PCs, give yourselves a round of applause. A victorious ending warrants celebration!
If the group plays another campaign in the same setting that takes place after your previous campaign, think through the repercussions of the last campaign and change the galaxy as needed. You might introduce new elements into the setting that call back to the previous campaign: newly powerful factions, new settlements, or new options for player characters, such as backgrounds, all based on the impact the previous PCs made on the world.