ensure Filename is writable when opened outside a terminal

Thanks Jimmy Miller for reporting this.

Created by  Kartik K. Agaram  on May 20, 2022
PGZJ6NATSMW4XH64XEPE5Q2EEYCMAMQIIP2OZXPNJ527234QPKMQC
Change contents