safely save and restore signal handler

calls to `signal.signal` not on the main thread would raise a
`ValueError`. Resolving by catching that exception and continuing