James Courtney wins race two of the Townsville 400