TeraSim: Uncovering Unknown Unsafe Events for Autonomous Vehicles through Generative Simulation