Only free memory if streaming or chunking (fixes #74)