open and close files