[ORIENT-7] Close memory databases just like local ones