You should get a syntax error, because the select columns are inconsistent with the group by. Use aggregation:
SELECT orderId,
MAX(CASE WHEN status = 'opened' THEN date END) AS openedDate,
MAX(CASE WHEN status = 'closed' THEN date END) AS closedDate
FROM orders
GROUP BY orderId;