Submissions save to db before sending to shepherd

* Fixes #162.
Shepherd no longer fails after one test request.

* There were two infinite loops in the cleanup code in the flock
  manager. Since that feature is incomplete it has been commented out
  for now.
* Fixes #163