Best way to close threaded writer and open reader

I wonder if this thread has any bearing (particularly the commit made): URL::DownloadTask::Listener::finished is called with file handle still open

The flush() was removed and the FileOutputStream gets reset() instead.