Miscellaneous fixes.

 - Fix SQL for retrieving accounting data.
 - Handle NONE value in accounting PETaskID
 - Add method to retrieve job request.
 - Add DB.Close() method.
arco: Fix inverted error check.
Merge pull request #4 from dtcaciuc/master

Miscellaneous fixes