It appears that AudioFormatWriter::writeFromAudioReader has a bug. The documentation says:
At least with a wave file reader and writer combo, this appears to fail, producing an empty (headers only) file. Passing any positive value for numSamplesToRead works as expected.
Looks like it just needs a:
if (numSamplesToRead < 0)
numSamplesToRead = reader.lengthInSamples;