Cleaning up the resources