After sewing a piece of hardware into your textiles take your needle and thread and back stitch along the electrical trace to bury your thread tail.
THEN clip the excess thread.
This helps prevent short circuits because you don’t have loose threads near your hardware connections.
Bonus – you don’t need unsightly messy fabric glue. ewwwwwwwww!