Fix nipapd sqlite file leak

An open instance in the main thread prevented others from being closed.
Merge pull request #591 from dosomder/485-close-sqlitedb

Fix nipapd sqlite file leak