lib: When clearing signal handlers, ignore the signals instead of restoring defaults
This is mainly happening in while the process is shutting down. Getting a
signal at a time when the normal signal handlers are gone isn't something
that is expected. It's better to just ignore the signal and let the process
to finish shutting down normally instead of getting killed.
This should also fix some unit tests where the child processes were
sometimes dying with SIGTERM due to these race conditions.