More than 400 jobs will be lost when Scotland's oil refinery ceases production in two months' time.