Open only once dependency file and add an option in debugging-checks mode for writing task dependency graph