Train service in Japan is generally reliable, but there can be delays from storms, earthquakes, accidents, etc. You can check schedules on https://japantravel.navitime.com/en/area/jp/route/ . It's best to allow extra time in case you miss your train or the very unlikely possibility that your train is cancelled. I would plan my itinerary to be in Tokyo the day before the flight, but I'm more cautious than most people. For your itinerary, that would mean splitting up your time in Tokyo, with a few days in Tokyo at the beginning of your trip and a few days in Tokyo at the end of your trip. An alternative would be to end your trip in Kyoto and fly home from one of the nearby Osaka airports (ITM or KIX).