Return to basedir if external calls fail

To make sure the pwd is world.basedir when all functions complete, I've
replaced the assert's I used before regarding external calls with
try/except/raise where the pwd is changed before raising the error.
This uses the check_call method of the subprocess module which throws an
error if the return code of the external call is not 0.