fix bugs in magit-wip-save

This fixes #613 and also some potential issues that I discovered when fixing the former.

@purcell Could you please test this before @sigma does the merge.

@sigma Should I rebase this onto `maint` instead? It's a bugfix after all. I haven't done so yet because there is another conflicting change touching `magit-wip-save`, which is in `master` but not `maint`.