Protect the progress bar with a lock.

Also some small improvements to the Progress class.