Effect of sample topology on the critical fields of mesoscopic superconductors