Fixed #21255 -- Closed connections after management command ran

Thanks kabakov.as@gmail.com for the report.
Yes, that was the point of Simon's comment on the previous patch version: https://github.com/django/django/pull/3805#discussion_r22299303