The German government has won its fight to retain its right to veto hostile takeovers of Volkswagen and to have a final say on any possible factory closures.