This leaves out removal of the realm service itself.

           context.removeService(realmServiceName);

line should stay from what I see.