close docker stdin streams when output is finished to exit properly