Implement Signal handling. This fixes #1, killing mem leaves terminal broken.