The snapping out Brownian motion