updating to use with when opening file
* removing unused file open