Start by examining the file you have created in a text or hex editor and looking to see exactly what you have written.
With luck, it should look like this:
X O .
O X O
X . O
But if it doesn't, then you need to look at exactly why.
The next thing to do is to look at how you read the file back in: you don't show that, but do remember that since you write spaces and newlines to the file, they will be present when you read the file back, and you will have to remove and cope with those.
And don't use the default folder for save games: if this ever got into production, the folder would be in Program Files and access to that is severely restricted to reduce virus activity. Use a folder that is related to the user if possible and that has read/write permissions for the relevant users.