Addresses review feedback from PR #2870:
- Fix NULL pointer dereference when finalisers run on unopened files
- Prevent infinite recursion in error handlers during buffered I/O
- Add explicit validation for FA_READ|FA_WRITE flag combinations
- Switch to mp_vfs_open for consistency with VFS abstraction
- Add NULL checks to file_buffer_on/off public APIs
The recursion fix ensures both file_buffer_off() and file_close()
clear their state before risky operations, making re-entry safe.