public function end($data = null) { if ($data) { $this->write($data); $this->end(); } else { $this->shouldClose = true; } }