Solves the issue of crashing on closing

This solves the issue #168