To give a sense of scale, the USS Washington firing on the IJN Kirishima in the Second Battle of Guadalcanal is reckoned as one of the shortest-range engagements in WWII... at about 5km.
That said, the remaining ships in the area were the surviving Japanese destroyers, and destroyers closing in closer to ships would not be unusual. Furthermore, the Yamato was in the process of abandoning ship at this point, and the destroyers may have been closing in to help fight fires or rescue survivors. I doubt they'd be closer than about a km from the ship at the time of the explosion, and none of the Japanese ships (so far as I'm aware) reported any effect from the explosion. Some planes (up to 7) were lost in the fireball, though.