opening and closing file