Fixed #21255 -- close connection in BaseCommand

Hi,

This is related to #21255 [0] where `BaseCommand` needs to close database connections after executing.

Added a call to `django.db.close_old_connections` in `execute`. Added a test case that reproduces the problem.

Thanks,
Javed

[0] https://code.djangoproject.com/ticket/21255