I just did some more debugging and apparently making a FileWriter wiped the text file. I took it away and now my code works.