Fixing dependency bug. Fixing bug where file handles would not get released.