Flush after printing so that progress bar works as desired.

Stdout is a LineBufferedWriter -- which, by default, only flushes on newlines -- so calling flush() is necessary to ensure that all output is printed to the screen when newlines are not printed.