The problem with your code is that previous output is not deleted. Since your output is not formatted to a fixed size, shorter output that appears later will not overwrite the last characters from the previous output.
For instance, when duration goes from 59 seconds to 1 minute, it changes from something like this:
[||||||||||||||||| ] 59.10% .58 of .98 Kbs processed... 0:0:0:59
to something like this:
[||||||||||||||||| ] 59.20% .58 of .98 Kbs processed... 0:0:1:0
But since the first line is longer than the second, the actual output will look like this:
[||||||||||||||||| ] 59.20% .58 of .98 Kbs processed... 0:0:1:09
You can solve it with either appending some whitespace, or by making the time output of a fixed size (e.g. always use 2 digits for seconds, minutes, hours, etc.).
Note: When running from within IntelliJ IDEA the remaining part of the line was actually removed, but when running from a shell it was not.