Removing the directory with os.rmdir instead of os.remove