improve cleanup on user interrupt.

user interrupts during adding of files would leave the loop of adding
more files but still do a subsequent checking for old files and would
not clean up file entries already marked as added.
This patch addresses those issues.
use exception for cleanup

if the script is interrupted it sets a flag. This flag is picked
up at several places to ensure a graceful shutdown. While it works, it
still creates a lot of duplicate code.
This patch introduces a new exception class that allows the script to
handle the cleaning up at exactly one place.
give better log message on error.