2 answers
For Apex debugging, it’s better to rely on Debug Logs instead of changing record states like “Closed,” since that can affect validation rules or challenge requirements. Use System.debug() and check logs in the Developer Console or Setup → Debug Logs.
Kind of like testing before final output—in printing I do the same by running a quick check from https://printertestingpage.com to avoid issues before the final result.