Added exiting and saving logs after one test is failed. Addded parameter for specifing temporary directory.