Added RAII to finding space group so there is no chance of leak.