Just a follow up to what Overread had to say.
If you can understand the following information, it can open up a whole new level of flash photography and camera operation understanding.
In your camera's specifications, you'll find listed the "flash sync speed". For many of today's digital cameras about 1/200, 1/250 of a second.
At that, and slower, shutter speeds both the front/first curtain has fully exposed the image sensor, and the rear/second curtains have not yet started to move to cover the image sensor (Nikon calls them front/rear, Canon calls the first/second).
From your images, we can also see that your flash is sync'ed to the front/first curtain. The flash fires at the instant the front/first curtain is fully open.
At faster shutter speeds, the rear/second curtain begins moving before the front/first curtain has fully opened, and partially blocks the image sensor when the flash fires at the instant the front/first curtain is fully open.
Most digital SLR camera's can also be set to rear or second sync, meaning the flash fires at the instant the rear/second curtain begins to move, instead of when the front/first curtin is fully open.
In that case, when the shutter is set to a speed shorter than the "flash sync speed" the black bands would be AT THE TOP OF THE IMAGE rather than at the bottom of the image.
For most flash photography, you'll want the flash to sync on the rear/second curtain.
You can see the front/first, rear/second curtains move, after the mirror raises out of the way, in this video.
Imagine what the flash would be doing if the flash was set to sync with the front/first curtain, and then the rear/second curtain.