#vulnerable code 
                                public void speichern() {
        try {
            FileOutputStream fstream = new FileOutputStream(datei);
            DataOutputStream out = new DataOutputStream(fstream);
            BufferedWriter br = new BufferedWriter(new OutputStreamWriter(out));
            for (String h : this) {
                br.write(h + "\n");
            }
            br.flush();
            out.close();
        } catch (Exception e) {//Catch exception if any
            Log.fehlerMeldung(978786563, Log.FEHLER_ART_PROG, History.class.getName(), e);
        }
    } 
                            #location 11 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void speichern() {
        try (BufferedWriter br = new BufferedWriter(new OutputStreamWriter(new DataOutputStream(Files.newOutputStream(historyFilePath)))))
        {
            for (String h : this)
                br.write(h + "\n");

            br.flush();
        } catch (Exception e) {//Catch exception if any
            Log.fehlerMeldung(978786563, Log.FEHLER_ART_PROG, History.class.getName(), e);
        }
    }