Fixes open file pointers