Make the test code exit after a few seconds

This avoids having to kill it.