HTC manages small Q3 profit as it tries to rebuild