Complete the following Java code snippet to append a line to an existing text file without overwriting its current contents:
PrintWriter out = new PrintWriter(new FileOutputStream("data.txt", true));
out.println("New data added.");
// Add the correct method call to ensure changes are saved