clean and dirty shutdown