Fix shutdown handler (inverted the flag).