title: Is it necessary to close each nested OutputStream and Writer separately?
body: <p>I am writing a piece of code:</p>
  
  <pre><code>OutputStream outputStream = new FileOutputStream(createdFile);
  GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream);
  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(gzipOutputStream));
  </code></pre>
  
  <p>Do I need to close every stream or writer like the following?</p>
  
  <pre><code>gzipOutputStream.close();
  bw.close();
  outputStream.close();
  </code></pre>
  
  <p>Or will just closing the last stream be fine?</p>
  
  <pre><code>bw.close();
  </code></pre>