Pass error pointers to the buffered_file methods

This is required to correctly detect aborted I/O operations.