Added the possibility to cancel opening a file