Distributed saving

Implements the new method for saving described in #8.  This includes creating locks and writing partial results.  Note however that loading from the saved results is not yet implemented, though it should now be possible from what is written.