Added openFile and closeFile methods