Geometric capture and escape of a microswimmer colliding with an obstacle