California firefighters have managed to take control of fires that had broken out in the south of the state near Los Angeles and had threatened several towns in the area.