All full questions* require a finite auxiliary verb† (that is, an auxiliary verb tensed for either past or present) before the subject. When the verb in the sentence is a construction with an auxiliary, this is accomplished by switching the subject and the auxiliary. When the verb is a lexical verb with no auxiliary, it is accomplished with DO-support: the tense is removed from the verb and put on a form of DO before the subject:
He is John Smith. → Is he John Smith?
He is [who]. → Who is he?
He has gone to town. → Has he gone to town?
He has gone [where]. → Where has he gone?
You look like an executive. → Do you look like an executive?
You look like [what]. → What do you look like?
Your second sentence, however, confuses two different constructions. There What is not an interrogative, a question word, but a relative pronoun heading a clause which acts as a noun phrase. The statement form would be:
[Subject What you said] [Verb turned out] [Complement to be true].
Consequently, the question form would be:
Did what you said turn out to be true?
* As Peter Flom points out, questions may be truncated very substantially in discourse context.
† BE is always considered an auxiliary, even when it is the only verb.
An open question is one that has many possible answers: subject or object questions are examples of this, as the there are multiple possibilities.
A closed question requires a yes or no answer.
Closed questions in the past simple are usually asked using **did*.
Did you break it?
I hadn't thought about it before, but I think that you have identified a pattern, in that we also use did for object questions, presumably so that the object pronoun can be moved to the start of the sentence.
Best Answer
The first form, Why did you close that and open this? is correct. (The use of both the question mark and the exclamation point together is non-standard, though.)
Interrogative sentences in the past tense are formed by did + unmarked infinitive. It may be easier to see the pattern if you split the question into two sentences: