public function stream_close()
	{
		if ( !\is_resource($this->resource) )
		{
			return;
		}

		// Close the resource.
		if ( $this->resourceType === static::RESOURCE_TYPE_FILE )
		{
			\fclose( $this->resource );
		}
		else if ( $this->ssl )
		{
			\fclose( $this->resource );
			// Only save the file when not loaded locally.
			$saveFile = $this->getSaveFile();
			\file_put_contents( $saveFile, $this->content );
		}
		else if ( $this->resourceType === static::RESOURCE_TYPE_SOCKET )
		{
			// This could throw errors if the socket is not connected on some systems.
			@\socket_shutdown( $this->resource );
			\socket_close( $this->resource );
			// Only save the file when not loaded locally.
			$saveFile = $this->getSaveFile();
			\file_put_contents( $saveFile, $this->content );
		}

		// Leave the resource for garbage clean-up.
		$this->resource = NULL;

		// Reset so we do not overwrite a file unintentionally for the next request.
		static::clearSaveFile();
	}