#fixed code
                                public void writeToFile(String path) throws IOException {
        FileOutputStream out = null;
        try {
            out = new FileOutputStream(path);
            this.write(out);
            out.flush();
        }
        finally {
            PoitlIOUtils.closeQuietlyMulti(this.doc, out);
        }
    }
#vulnerable code 
                                public void writeToFile(String path) throws IOException {
        FileOutputStream out = new FileOutputStream(path);
        this.write(out);
        this.close();
        out.flush();
        out.close();
    } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK