Make finished berths deberth by time priority.

The way the simulation checked for a finished berth was that it looped
through the berths array and returned the first finished one.  Now it
returns the berth that finished earliest, no matter what.