You may imagine that having an upper fuel tank still having heavy liquid inside while landing, as today some reusable rockets do in a vertical attitude, may ease the machine falling on its side. Is this a practical concern, and is this concept applied in actual landings of rockets? Having the weight in the low part of the cylinder will help stability. Will it?
No, it is not necessary and in fact impossible for a number of reasons.
If the mission allows for the first stage to return, the proper amount of fuel is calculated to achieve the landing.
Furthermore the engines are throttled down to 60-40% of the thrust. This requires a certain minimum pressure for the turbo pumps to work, so the tanks can never be totally empty.
The upper tank is the oxygen tank and makes up about 2/3 of the stage, so when there is not much fuel left, it is still located in the lower third of the rocket. If the oxygen tank was empty, the engines would not work anymore.
The landing computer for the first stage calculates the return path to the launch pad and accounts for the fuel left. You can read more about that in a nice article from qz.
The nine engines and the octaweb mounting structure have a much larger weight and are located below the mounting point of the legs. This makes the rocket very stable.
Once the rocket is down, SpaceX has been observed to either weld it to the landing ship or tie it down. There are also efforts under way to use a robot for this.