Purification of quantum trajectories