What is the role of 在 in 您要在关闭文件前保存吗？ I was using a text editor in Chinese, when I tried to exit without saving the currently opened  file it showed me this sentence:


  您要在关闭文件前保存吗？


What is the role of 在 here? Is it related to the usage of (some event)前? Or can be omitted without altering the sentence meaning?
It is part of the construction:

在....前
'before....' (used as a conjunction).

Here it means 'Before you close the file, do you want to save it?' The 在 effectively indicates a point in time, i.e., 'at' a particular time. (Literally translated into English, this would become 'at [the time] before you close the file').
This is typical of constructions like:

在...前
'before'
在...时
'when'
在...后
'after'
当...时
'when'

This tends to be a written usage and is omitted in conversation (and often in writing).