Fix shutdown taking long amounts of time