fixed undefined behavior in task shutdown
simplified
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel