It is impossible for the needle to pierce the cap.. they are made "pierce-proof." And the needle is not going to bend to the side while it's inside a solid plastic cap! Even if this did happen, I truly believe you have nothing to be worried about. HIV
can't be transmitted from a simple needle poke unless infected bodily fluids were injected into you. Needle sticks are scary situations but I really don't think you need to be worried.