java – Adding more info to CSV file

i have the following code that i use to add information into a CSV file. This adds an animal to a Zoo.csv

public class AddAnimal {
public static void main(String() args) {

    String animal = "Fish";
    String filepath="Zoo.csv";

    saveRecord(animal,filepath);
}

public static void saveRecord(String animal, String filepath){
    try{
        FileWriter fw =new FileWriter(filepath,true);
        BufferedWriter bw =new BufferedWriter(fw);
        PrintWriter pw=new PrintWriter(bw);

        pw.println(animal);
        pw.flush();
        pw.close();

        System.out.println("Your Record was saved");
    }
    catch(Exception E){
        System.out.println("Your Record was not saved");
    }
}

I am trying to add a name for the animal in the same record using the following code but the name just does not get added

public class AddName {

private static Scanner x;

public static void main(String() args) {

    String filepath="Zoo.csv";
    String editTerm="Fish";
    String addedName="Ronald";

    addToRecord(filepath,editTerm,addedName);

}
public static void addToRecord(String filepath,String editTerm,String addedName){

    String tempFile="temp.csv";
    File oldFile=new File(filepath);
    File newFile=new File(tempFile);
    String animal="";
    String name="";

    try{
        FileWriter fw=new FileWriter(tempFile,true);
        BufferedWriter bw=new BufferedWriter(fw);
        PrintWriter pw=new PrintWriter(bw);
        x = new Scanner(new File(filepath));
        x.useDelimiter("(,n)");

        while (x.hasNext()){
            animal=x.next();
            name=x.next();
            if (animal.equals(editTerm)){
                pw.println(editTerm+","+addedName);
            }
            else {
                pw.println(editTerm+","+name);
            }
        }
        x.close();
        pw.flush();
        pw.close();
        oldFile.delete();
        File dump=new File(filepath);
        newFile.renameTo(dump);
        System.out.println("Your Record was saved");
    }
    catch(Exception e){
        System.out.println("Your Record was not saved");
    }
}

After i execute the AddName , i just get handed with the Exception e at the end of the code. Where could it be going wrong ?