Conjugate symmetry Problem
You are not handling DC and Nyquist correctly. These are both real and don't have a conjugate "partner" so you need to multiply them with .5 instead

Try

x = randn(1024,1);
X = fft(x);  
Xt = X;  
Xt( (end/2+2):end ) = 0;  
Xt( (end/2+1)) = 0.5*Xt( (end/2+1)); 
Xt( 1) = 0.5*Xt( 1); 

xr = 2 * real( ifft( Xt ) );  
Xr = fft(xr);
delta = abs(Xr-X).^2;
fprintf('Diff = %6.2f dB\n', 10*log10(mean(delta)/mean(X.*conj(X))));