public function writeFile($filename, &$buffer, $appendToFile = false)
	{
		$fileMode = 'w';

		// Switch the filemode when we want to append to the file
		if ($appendToFile)
		{
			$fileMode = 'a';
		}

		if ($this->open($filename, $fileMode))
		{
			$result = $this->write($buffer);
			$this->chmod();
			$this->close();

			return $result;
		}

		return false;
	}