main: fixed crash occurring on exit.
main: added argument allowing program to be run for a fixed amount of frames.