fixed empty() function call
fixed fopen access type parameter and added fclose() to close the stream