Fill missing end date in historic mode only once

This fixes a bug with the historic mode where while running
the script with a start date but no end date, the script
would keep running as it updates the end date in each loop.