fixed shutdown order to prevent crash when kernel interface schedules events