close opened file after being used