Use Realm.close() in unit tests

This close() will never get called due to expected exception.