Handle deleting logfile at program shutdown in core destructor

* Prevents order-of-destructor issues from losing the log filename before
  the core destructor uses it to delete the logfile.
Use serialised program initial states to translate uniform locations

* If you're capturing and replaying on the same driver it's insanely
  unlikely that this translation will be anything other than the identity
  map, although it wouldn't be illegal to renumber locations. However this
  should allow moving captures between vendors/driver versions/platforms,
  which in the past wasn't possible because locations would change (quite
  validly) when the programs were recompiled. There might be other issues,
  but at least this one is fixed.