Logano wins NASCAR race at Richmond