You need some exception handling to clean up the created files and directories if something goes wrong