Fix a potential memory leak bug in File
Made an optimization for empty frame