protected function writeFile($payload)
	{
		// construct the session file name
		$file = $this->config['file']['path'].$this->config['file']['cookie_name'].'_'.$this->sessionId;

		// open the file
		if ( ! $handle = fopen($file,'c'))
		{
			throw new \Exception('Could not open the session file in "'.$this->config['file']['path']." for write access");
		}

		// wait for a lock
		while ( ! flock($handle, LOCK_EX));

		// erase existing contents
		ftruncate($handle, 0);

		// write the session data
		fwrite($handle, $payload);

		//release the lock
		flock($handle, LOCK_UN);

		// close the file
		fclose($handle);

		return true;
	}