Wav File Header Data not being created properly

I have been following the code laid out in this forum post and referenced on this git and TBH I’m a noob and am not really sure why to use a unique ptr object. when I define a file output stream as a member variable and reference it in my writer like this

FileOutputStream* outputTo = file.createOutputStream(); //in membervariables
//in same place as before
writer.reset(format.createWriterFor(outputTo, 
			currentSampleRate,
			8,
			24,
			{},
			0));

 void releaseResources() override
    { 
		delete outputTo;
		writer.release();
	}

I still get the memory leak error. Do you have an example of another way to define my AudioFormatWriter?