3ds turns off when opened fully or too fast
3ds turns off completely when opened
I've not seen this issue on the 3DS yet, but on the DS Lite sometimes the cable to the top LCD could be loose and result in the behavior you described. As someone else said it could be short (i.e. a broken cable) but I think it's more likely just loose. Check where the cable plugs into the motherboard.