fixes #31. Close plugin now correctly calls cleanup functions