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.
To run the tests, do:cd tests/python run-tests.pySee http://mercurial.selenic.com/wiki/WritingTests formore information on writing tests.