Factor loader into a database storer and a batch loader

this doesn't wait on the the loadworkers finishing their current task before exiting. I think this could cause leaks on SIGINT.