Not much longer. Even if a foreign power doesn't open them up, there would be an internal rebellion eventually. There were always elements in Japan who wanted to open up and knew the dangers of not doing so. It all depends on how long those elements can be suppressed.