Make predict() close progress bars after finishing (#17952)
Fixes #17952 by adding an `on_predict` callback. 

## Who can review?

@sgugger

_The documentation is not available anymore as the PR was closed or merged._<|||||>Not sure about the tests, should they be there for notebooks too? I'll go with this for now<|||||>I just triggered all them by pushing a copy of your branch in the main fork of the repo, circleCI is very finnicky. Let's check everything is green!<|||||>Failure is flaky, so this is good to merge, thanks again!