According to Mark Hamill, the final scene of The Empire Strikes Back wasn’t filmed during principal photography.
It was shot four months later as an additional scene after George Lucas worried the film’s ending was too bleak. With the heroes defeated and Han Solo gone, they wanted to leave audiences with one final moment of hope before the credits rolled.