rstrip function for files