gracefully termiante the map job after pattern found