Fized closing operations

Errors exist in code, unknown where