Emergency legislation to end release of terrorists half way through jail terms