add flush command, instead of making everything sync

fix leaks associated with protocol buffers shutdown