Fix nipapd sqlite file leak

Sqlite connection was not properly closed. Additionally, an open instance in the main thread would prevent others from being closed.

Some links that led me to this:
http://stackoverflow.com/questions/10332253/sqlite-persisting-file-handles-in-wal-mode
https://docs.python.org/2/reference/datamodel.html#object.__del__

Part of https://github.com/SpriteLink/NIPAP/issues/485