Cleaning up rethinkdb connection leaks by using after filters on application controller and the API endpoint.