Move srand() to main of unit tests
Check that output file is open