Should call close() instead of dupplicating its code imho