Nested write transactions are not supported.

Before this change, the following code snippet would wait for ever:

    Realm realm = Realm.getInstance();
    realm.beginTransaction();
    realm.beginTransaction();

When applying this PR, the third line will throw an exception.

@bmunkholm @benjaminprakash88 @emanuelez