'Stopping Down' your aperture, doesn't necessarily affect focus. It will affect your Depth of Field, but in this case, the city is so far away, that you would be at infinity focus anyway, so your DOF isn't an issue.
If the shot is out of focus, it's because you didn't focus it accurately.
However, there are other things that might affect how sharp an image looks. The first thing to look at is the shutter speed. Slower shutter speeds will turn motion into blur. The cityscape obviously isn't moving, but the camera might be. Certainly if you're holding it in your hands, it would be moving...but even if you had it on a tripod or other support, it may not be perfectly still. For example, if you press the shutter button while it's on a tripod, that will move the camera, causing blur. When the mirror flips up and the shutter opens, that maybe move the camera a little bit. Many cameras have a 'mirror lock up' function to help alleviate that. You also have to consider the stability of the tripod. Cheaper tripods, or doing things like extending the centre column, will make for a less stable support, which may allow some minor movement.
Lastly, consider the aperture that you're shooting at. Not in terms of focus or DOF, but how well that lens performs at that aperture. Most lenses are not at their best when used at their largest (maximum) aperture. Most lenses are best around F8.