Added timeout for agent downloads. Fixed failed cleanup in integration tests.