Passive laser Q-switching using a dye-doped liquid-crystalline layer near total internal reflection