#vulnerable code 
                                @Before
    public void setUp() throws Exception {
        when(record.getPayload()).thenReturn(PAYLOAD);
        file = new File(JAVA_IO_TMPDIR + FILE_SEPARATOR + "test.txt");
        file.createNewFile();
        writer = new FileRecordWriter(new FileWriter(file));
    } 
                            #location 6 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Before
    public void setUp() throws Exception {
        Files.createFile(path);
        record1 = new StringRecord(header, "foo");
        record2 = new StringRecord(header, "bar");
        writer = new FileRecordWriter(path);
        writer.open();
    }