close stream after download completed.
add logger support.