Final fixes for proper shutdown of tornado