in your example you have a PrintWriter wrapping a BufferedWriter wrapping a FileWriter.
Because of this it's sufficient to call close() on the outermost I/O object (PrintWriter) and this one will call close() on the writer it has wrapped which in turn will call close() on the writer it has wrapped and so on until the end of the chain (the innermost writer = FileWriter).
Unfortunately I don't find a really good link at the moment which explains the chaining of Java I/O classes.
Perhaps this Wikipedia article about the decorator pattern may enlighten you. It doesn't describe the Java I/O classes at all, but it's effectively the decorator design pattern which is used when wrapping one object with another as in the case with the Java I/O classes. This and related links hopefully may help you to better understand the concept behind this.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop