One time I got laid off for not closing enough stories. Meanwhile the guy that was kept on was the source of a lot of bugs. So what is that if you generate your own problems and "solve" them?
That's a different problem from the one Planning Poker addresses.
But to answer your question, the original story should have acceptance criteria such that the ticket can't be closed if there are bugs. Failing that, the bug ticket should be linked to the original ticket.
Continual feedback is also important. If the manager who laid you off valued velocity over bug-free code, that should have been communicated way earlier.
To be clear, though, "Who got most work done this week?" is not a useful question.