Break the worker loop if a TERM or INT signal received.