Fix resource leak in Command.