Pirates extend Andrew Heaney