Rearranging the output of mysql query
You don't seem to need the ticket table. The output does contain the ticket.id column, but it is always same as ticket_history.ticket_id, which is also included in the output.

In view of the above, the following query reads only ticket_history. It uses conditional aggregation to build the output you are after:

SELECT
  ticket_id,
  MIN(id) AS id,
  MAX(CASE name WHEN '%%Close' THEN NULL ELSE create_time END) AS open_time,
  MAX(CASE name WHEN '%%Close' THEN create_time ELSE NULL END) AS close_time
FROM ticket_history
GROUP BY
  ticket_id
HAVING COUNT(name LIKE '%\%Close'            OR NULL) = 1
   AND COUNT(name LIKE '%\%Raw\%% %\%new\%%' OR NULL) = 1
;


The HAVING clause makes sure a ticket has both open and close rows. The OR NULL trick is explained in this Stack Overflow answer:


Why do I need “OR NULL” in MySQL when counting rows with a condition


The id column is derived as MIN(id) on the assumption that a Close row will always appear after the corresponding Open one, and therefore the latter's id will always be lower than the former's.

The open_time and close_time values are obtained using conditional aggregation. Depending on whether the name column matches the '%\%Close' pattern or not, the create_time column is aggregated as either close_time or open_time.

You can use this SQL Fiddle demo to try the solution.