For job with retry - the attempt count doesn't match with log file when inserting into database - issue #331

The attempt # needs to be saved before firing the job finished event.  One of the listeners of this event will try to retry a failed job and the retry counter will be incremented.

To match up the attempt count value and the log file, we need to save it and then fire the event. 
attempNo -> attemptNo

You can also move this line above line 459 and then use `attemptNo` in the logInfo() call instead of node.getAttempt()