Another civil war ensued after the death of Karim Khan in 1779, out of which Aqa Mohammad Khan emerged, founding the Qajar Dynasty in 1794. Whose death in 1779 led to a civil war in Iran