Implement close as a macro