Reuse Die function to get the cancellation signal

Once a message is sent to channel ‘kill’, the function will stop since
we reach the end of main. And I changed the test file a bit.