#vulnerable code 
                                public static void saveMeBackup(File f, String toWrite) throws IOException
    {
        String backup = "/Users/bekahoverdorf/btbackup/timestamp" + BekahUtil.getNow();

        String path = f.getAbsolutePath();
        Scanner pathScanner = new Scanner(path).useDelimiter("/");

        boolean record = false;
        while (pathScanner.hasNext())
        {
            String temp = pathScanner.next();
            if (record)
            {
                backup += "/" + temp;
            }
            if (temp.equals("Documents") || temp.equals("NetBeansProjects"))
            {
                record = true;
            }
        }
        // make the backup


        File backupFile = new File(backup);


        File backupDir = new File(backupFile.getParent());
        backupDir.mkdirs();
        backupFile.createNewFile();

        FileWriter backupfstream = new FileWriter(backupFile);
        BufferedWriter backupout = new BufferedWriter(backupfstream);
        backupout.write(toWrite);
        backupout.close();

        // make the file
        File dir = new File(f.getParent());
        dir.mkdirs();
        f.createNewFile();

        FileWriter fstream = new FileWriter(f);
        BufferedWriter out = new BufferedWriter(fstream);
        out.write(toWrite);
        out.close();
    } 
                            #location 6 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static void saveMeBackup(File f, String toWrite) throws IOException
    {
        String backup = "/Users/bekahoverdorf/btbackup/timestamp" + BekahUtil.getNow();

        String path = f.getAbsolutePath();
        Scanner baseScanner = new Scanner(path);
        Scanner pathScanner = baseScanner.useDelimiter("/");

        boolean record = false;
        while (pathScanner.hasNext())
        {
            String temp = pathScanner.next();
            if (record)
            {
                backup += "/" + temp;
            }
            if (temp.equals("Documents") || temp.equals("NetBeansProjects"))
            {
                record = true;
            }
        }
        // make the backup


        File backupFile = new File(backup);


        File backupDir = new File(backupFile.getParent());
        backupDir.mkdirs();
        backupFile.createNewFile();

        FileWriter backupfstream = new FileWriter(backupFile);
        BufferedWriter backupout = new BufferedWriter(backupfstream);
        backupout.write(toWrite);
        backupout.close();

        // make the file
        File dir = new File(f.getParent());
        dir.mkdirs();
        f.createNewFile();

        FileWriter fstream = new FileWriter(f);
        BufferedWriter out = new BufferedWriter(fstream);
        out.write(toWrite);
        out.close();
        pathScanner.close();
        baseScanner.close();
    }