Added clean rule and delete on error so that no empty files are left.