separate try blocks for dir removal and parent dir removal