Closing state file after using it