Close controller after command execution