added closed list (including a dummy, such that tree and graphsearch can be implemented by the same algorithm)