Shares in Mainland China End Worst Month in 6 Years