Spin-Peierls transition to a Haldane phase