Modified file open to make it more secure as per #16