Change: Replaced "get_position()" with "tell()" and "truncate()" with
"flush()" for better compatibility with methods expecting file objects