Fixed #21255 -- Closed connections after management command ran

Thanks kabakov.as@gmail.com for the report.
I guess you don't use something simpler like:
```
for connection in self.all():
    connection.close()
```
Because that might initialize database connections that aren't used by the management command?