Flush command queues when .end() is called, to prevent command callbacks from never being called.  Also set a flag once connection has ended to prevent more commands from being enqueued.