Add instance id to diagnostic file names

Fixes #748