Multilevel resistive switching memory based on a CH 3 NH 3 PbI 3 − x Cl x film with potassium chloride additives