end file proparely