using codeblock to open/close file