Makes sure the StreamWriter is open before writing to it.

I was thinking that this should be added because if for some reason if a bot is unable to write to the file the whole application will crash so it should just be checked to prevent that.