fix bz 1156361. Race condition between destroy-app and configure.

@abhgupta quick review please. Thanks.
Dir.exists should be Dir.exists?