A test for closing database

@powmedia: Adding a test for #12, as you requested.

If you remove the `db.close()` call from the test I've added, it would hang.
This test is a kind of an integration test, so I've implemented in a separate file.