Search for a config and switch working dir to its location

This fixes the nasty "This command needs to run inside an existing
Nikola site." message when nikola build command is being executed
in a subfolder of an existing Nikola site, closes #910
Do not enter infinite loop on missing config
Merge pull request #911 from roman-yepishev/get-root-dir

Search for a config and switch working dir to its location