Query results may be buffered in temporary storage, and this temporary storage is closed and garbage collected only when the session is closed. After all, none of the JCR query-related objects has any notion of a close method.
While this works, it may cause problems in sessions that use lots of queries or a few queries with lots of results. A better way to would be to add a public "close()" method to the QueryResults, and in fact making QueryResults extend AutoCloseable to enable it to be used within a try-with-resources block. This would give clients more control over when resources are cleaned up, although it would be optional and fall back to having the session's close() method clean up all resources.