Fidelity of states in infinite-dimensional quantum systems