Only write into the TestSignals channel when it exists.

Because the channel is blocking, if no one reads from it, the
goroutine gets locked. This was only used in unit tests, so no one
was reading from it in production. Fixes #26.