Spain agrees investment plan with Airbus in exchange for fewer job losses