Added ref counting to neo4j database services.

Also added javadocs for missing functions.
Fixes #291