Added ref counting to neo4j database services.

Also added javadocs for missing functions.
Fixes #291
Merge remote-tracking branch 'origin/pr/306'