improve error messages in workflow-wrapper.pl
fix typo in workflow-wrapper.pl
fix performance problem with historian
historian bugfix: lock instance and execution rows

This fixes a race condition when setting an execution's status.