Also update the metadata correctly when an analysis finishes

Closes #476 for good