Question: > 
> The man stuttered too, perhaps when (he was) confused.
> 
> 
> 

Can I omit "he was" in this sentence? Why or why not?

Answer: 
The sentence (A) isn't correct grammatically. 

"I couldn't open the door" is in the past. As a matter of fact, you are locked in and unable to open the door at the present time. So the correct sentence should be:

I am locked in here and cannot open the door. Can you help me?

The second sentence (B), which is in the past, is correct grammatically. Could is the past of can.
usually could can be used for wishing in a sentence like "I could have a pet"
we can say the second sentence is correct but the first one is not pretty okay!
for present(if we just want to use can as its own meaning) we can use Can