Changed name for grant file to be the same as dbname

The previous construction caused a race condition where two different grants could get assigned the same file name.

Add tests for these cases.
Merge pull request #27 from netmanagers/master

Minor bug correction to grant define.