Fix for not closing files after done downloading.