file_resource: convert mode to int if it is a string