title: Veracode CWE ID 404 Improper Resource Shutdown or Release
body: <p>I have this code:</p>
  
  <pre><code>    try {
          BufferedWriter bw = null;
          FileWriter fw = null;
          try {
              final String fileName = getFileName();
              File propertiesFile=new File(getFilesDir(), fileName);
              fw = new FileWriter(propertiesFile);
              bw = new BufferedWriter(fw);
              bw.write(s);
              File file = new File(getFilesDir(), fileName);
  
          } catch (IOException e) {
  
          }finally{
              if(bw != null){
                  bw.close();
              }
              if(fw != null){
                  fw.close();
              }
              if(bw != null){
                  bw.close();
              }
          }
      } catch (Exception e) {
      }
  </code></pre>
  
  <p>Veracode detected a flaw (Improper Resource Shutdown or Release ) on this line <strong>bw.write(s);</strong>
  How to fix this?
  Thanks in advance</p>