Only open file if we actually going to write triangles to it (reduce amount of file descriptors open)