You must close the FileWriter, otherwise it won't
flush the current buffer. You can call the flush method directly..
fileWriter.flush()
fileWriter.close()
You don't need to use the flush method if you are closing the file.
The flush can be used for example if your program runs for a while
and outputs something in a file and you want to check it