It all works fine and the session continues when I run the same app under RStudio running on the same server and using the button ('Run App').
createDB <- function(filepath, filename, dbfile){
data <- read_csv(filepath,
locale = locale(encoding = "ISO-8859-2",
asciify = TRUE))
# give proper english names to columns
colnames(data) <- names
data$Email <- tolower(data$Email)
version <- data.frame(version=filename)
# create sqlite and save
mydb <- dbConnect(RSQLite::SQLite(), dbfile)
dbWriteTable(mydb, "data", data, overwrite=TRUE)
dbWriteTable(mydb, "version", version, overwrite=TRUE)
dbDisconnect(mydb)
}