NSW prisons boss announces retirement after four decades in corrections