The Brauer-Manin obstruction on Kummer varieties and ranks of twists of abelian varieties