fix for closing unopenened file handle when desired number of pieces have been downloaded.
added more logging.