Thunder, lightning and hail have struck parts of the UK in a dramatic end to the summer season.