Bug fix: flushMemory operation should be asynchronous, so as not to block the main thread. Fixes issue #113