Added deadlock prevention using release of resources