When the government closed Japan’s doors to the West, it ordered most Europeans to leave the country.
It is referred as the Sakoku policy and it was a reaction to the unequal trade treaties forced upon them by the Commodore Perry and its ships.
The Korea and China answers cannot be valid, since they are not part of the "West", being Asian countries as well, plus trade with China was important during that Sakoku policy.