To close the app on your iMac you have to use a mouse or trackpad. Move the pointer to the red button in the top-left corner of the app window and click on it. The app window should immediately close.
Alternatively, you can use keyboard key combinations to close an app on your iMac. Simply press Command+Q keys.