fixed bug with not closing fopen

- running multiple tests is now supported
- still have a bug in the form of first values in the time arrays being
overwritten