write buffered to disk in DocumentLoader