The final scene was the last scene filmed. If you look closely at Teal'c (Christopher Judge), he appears to be holding back tears.
In the original script, Vala makes repeated sexual advances to Daniel, who eventually gives in. Both Michael Shanks and Claudia Black said that would would cheapen the last episode and give the wrong impression of their characters. The script was rewritten to show that Daniel and Vala have genuine feelings for each other.
When Thor beams on the ship, and Sam seems to know exactly which Asgard it is, Vala asks, "Out of curiosity, how can you tell the difference?" Daniel says, "The voice." Michael Shanks provided the voice of Thor.
The original script included a romantic relationship between Teal'c and Sam. This was written out, but Christopher Judge and Amanda Tapping still played the roles as if the characters did have a secret relationship.