Unfortunately, this is going to plague you until you resolve the problem. By handling the situation unsuccessfully in the past, you continue the karmic thread creating the problem in the first place.

Next time it happens, just stop and relax. Then confidently think about resolving the problem. You might plan ahead and say "OK, next time it happens, I'll relax, be confident and slowely open my eyes", or you might choose to visualize your surroundings through your eye lids which will ultimately make them disappear anyway.

It's all about relaxation, confidence and minimization of a poor emotional reaction to the problem.

I had this issue over the last month a few times and I've resolved it.