Germany plans to close tax loophole for foreign firms