Implements headless browser

This is the same pull request as #11 except
1) Rebased to current master
2) Forces closebrowseronexit if config.headless is set.