Amid heated scenes during a late-night debate, a narrow majority of MPs have voted to elect candidates nominated by PiS to the Constitutional Tribunal.