Fixed Issue #3 (Database result set inconsistent). Updated the database layer to close all sessions and transaction.

Also added the duration attribute to the TaskResponse class.