func (c *Closer) Close() {
	c.mutex.Lock()
	if c.isClosed {
		c.mutex.Unlock()
		return
	}
	c.isClosed = true
	c.mutex.Unlock()
	close(c.IsClosedChan)
	c.f()
}
Close calls the function and sets the IsClosed boolean.
package closer
import (
	"sync"
)
type Closer struct {
	IsClosedChan chan struct{}
	f        func()
	isClosed bool
	mutex    sync.Mutex
}
func New(f func()) *Closer {
	return &Closer{
		IsClosedChan: make(chan struct{}),
		f:            f,
	}
}