Castillo wins it for D-backs with walk-off walk