1998 Hyundai Tiburon shuts off

Why does my car ride great one minute and then turns off by itself?sometimes quietly turns off and sometimes makes loud rumbling and growling sounds before turning off.Only happens when Idling.Airflow sensor shows up on computer but changing it does Not help. GETTING DANGEROUS