Running the program for a specific amount of time

The Arduino is always running. The simplest approach is to put everything in setup() and exit the function after two minutes.

If you want to save power, you can buy an external power switch with digital input, or have the Arduino enter power down sleep mode.

PS: "void" in front of a function name (like loop()) means that the function does not return a value.