Reorder logic to cleanup snapshots

Signed-off-by: Carlos Aguado Sanchez <carlos.aguado@epfl.ch>