According to the error you're getting in the exception message box, you have that file open somewhere else. I'm a little rusty on my Visual Basic, but something like this should work for you: (this is the way I normally do it, if I don't split into other methods)
Private Sub ToolStripButton4_Click(sender As Object, e As System.EventArgs) Handles ToolStripButton4.Click
Dim save As New SaveFileDialog
save.Filter = "Nspire Lua files (*.lua)|*.lua|txt files (*.txt)|*.txt|All files (*.*)|*.*"
save.FilterIndex = 2
save.RestoreDirectory = True
save.CreatePrompt = True
save.OverwritePrompt = True
If save.ShowDialog() = DialogResult.Ok Then
System.IO.StreamWriter writer
Using writer As New System.IO.StreamWriter(save.FileName)
writer.Write(addText.Text)
End Using
End If
End Sub
EDIT: What "Using" does is if the class you specify to "Use" is disposable, then all of the cleanup will be handled for you (i.e. closing, disposing, etc.)