dispatch: check for None before closing repo
We were trying to call close() if repo == None and req.repo != None.
This can happen when running commands that don't take a repo.
....................----------------------------------------------------------------------Ran 20 tests in 0.000sOK