Re-work shutdown slightly, add SIGINT handler.
Fix bug that causes repeat URLs to try to insert dup keys.