implemented file open and close