The constructor of the WebDriver_Driver class uses the following preg_match to parse out the seesion id:
preg_match("/\nLocation:./(.)\n/", $response['header'], $matches)
This fails whenever the Location header is the last header sent and thus is not followed by a "\n".
A simple fix would be to change the line to
preg_match("/\nLocation:./(.)\n/", $response['header']."\n", $matches)