add a cleanup method

This adds a cleanup method to the compiler interface and arranges to
call it.