You should check the return value of ShowDialog and only look do something if the return value means that the user has pressed OK.
The user can also cancel the operation and then sfd.FileName will be empty.
if (sfd.ShowDialog() == DialogResult.OK) // Sorry for the c# syntax
{
Dim sw As New StreamWriter(sfd.FileName)
sw.Write(RichTextBox1.Text)
sw.Close()
}