Mitigate the file size growing problem

This change does the following:
 * disables the caching of Realm instances in threads without an event loop
 * makes the Realm class implement Closable
 * does reference counting for closing Realm instances
 * checks if the Realm instance has not been closed before any operation
Only commit if needed during instantiation and re-enable caching
Fix the annotations processor unit test
Add a unit test for reference counting
Comment out the unit test temporarily
Actually close the comment
Merge remote-tracking branch 'origin/master' into ez-file-size

Conflicts:
	realm-annotations-processor/src/test/resources/io/realm/SimpleRealmProxy.java
Merge pull request #617 from realm/ez-file-size

Mitigate the file size growing problem
Merge branch 'master' into cm-cyclic-references

Conflicts:
	realm/src/main/java/io/realm/Realm.java