Fix exitEventLoop() whan called from a task that has been started before runEventLoop().
Fix the MongoDB and Redis tests to properly exit on error.
Make some code style adjustments.