Libya rival factions agree to hold general elections in 2018