It is quite easy to hide the browser without XVFB. Just install PhantomJS. Then, change this line:
driver = webdriver.Firefox()
driver = webdriver.PhantomJS()
The rest of your code won't need to be changed and no browser will open. For debugging purposes, use driver.save_screenshot('screen.png') at different steps of your code.