Ensure buffer is save in a file